<div dir="ltr">Organized the patch files again that you can just patch -p1 < zlib-patch.txt<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 4:45 PM, Park, Sungjin <span dir="ltr"><<a href="mailto:jinni.park@gmail.com" target="_blank">jinni.park@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Related with this problem, I tried attached simple patches to define zlib:inflate/3. The last parameter, MaxSize is handed over to the port driver. And changed the port driver to stop streaming at this point.<div><br></div><div>Patches compile good but at runtime, I get undefined function exception even it's exported by zlib.erl</div><div><br></div><div>1> Data=<<"0123456789">>.</div><div>2> Compressed=zlib:compress(Data).</div><div>3> Z=zlib:open().</div><div>4> zlib:inflateInit(Z).</div><div>5> catch zlib:inflate(Z,Compressed,9).</div><div><div>{'EXIT',{undef,[{zlib,inflate,</div><div> [#Port<0.582>,</div><div> <<120,156,51,48,52,50,54,49,53,51,183,0,0,8,241,1,213>>,</div><div> 9],</div><div> []},</div><div> {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,661}]},</div><div> {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,434}]},</div><div> {shell,exprs,7,[{file,"shell.erl"},{line,676}]},</div><div> {shell,eval_exprs,7,[{file,"shell.erl"},{line,631}]},</div><div> {shell,eval_loop,3,[{file,"shell.erl"},{line,616}]}]}}</div></div><div>...</div><div><br></div><div>And also I get einval error (maybe from the port driver) when I call zlib:inflate/2.</div><div><br></div><div>6> catch zlib:inflate(Z,Compressed).</div><div><div>{'EXIT',{einval,[{zlib,call,3,[]},</div><div> {zlib,inflate,2,[]},</div><div> {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,661}]},</div><div> {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,434}]},</div><div> {shell,exprs,7,[{file,"shell.erl"},{line,676}]},</div><div> {shell,eval_exprs,7,[{file,"shell.erl"},{line,631}]},</div><div> {shell,eval_loop,3,[{file,"shell.erl"},{line,616}]}]}}</div></div><div><br></div><div>I suspect that the port driver patch is applied but zlib.erl is not.</div><div>Is there any other place that I have to define zlib:inflate/3? Or did I make other mistake?</div><div><br></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 1:11 PM, Richard A. O'Keefe <span dir="ltr"><<a href="mailto:ok@cs.otago.ac.nz" target="_blank">ok@cs.otago.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
On 25/09/2014, at 5:46 AM, Tony Rogvall wrote:<br>
><br>
> Thanks. Cool stuff :-)<br>
><br>
> The following is also a fun version ( I am not the only one to blame for api design faults :-)<br>
<br>
</span>[[billion laughs]]<br>
<br>
Wikimedia markup has the same problem.<br>
<br>
For that matter, templates make the C++ type language<br>
a Turing-complete (but seriously ugly) functional programming<br>
language, and the various features that have been added to<br>
the Haskell type system since 2010 make that a Turing-complete<br>
logic programming language, so you can write a fairly short<br>
C++ or Haskell program that takes as long to type-check as<br>
you please.<br>
<br>
The Erlang binary term representation is just on the safe side<br>
of this kind of attack. The fact that backreferences can only<br>
be used to refer to *atoms* keeps it safe.<br>
<br>
I'm a little bit sad that this seems like a good reason not<br>
to make the binary representation "smarter".<br>
<br>
Oh heck. The binary format I use to provide persistence for<br>
Smalltalk has precisely this kind of problem, but if I<br>
*didn't* allow backreferences to arbitrary objects I would not<br>
be able to handle cyclic object graphs.<br>
<br>
I console myself: UBF(A) is on the wrong side of the safety<br>
line. The term you get by decoding n UBF(a) bytes will be<br>
O(n) in size, but it may take O(2**n) time to traverse it.<br>
<div><div><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="">-- <br>Park, Sungjin<div>-------------------------------------------------------------------------------------------------------------------</div><div>Peculiar travel suggestions are dancing lessons from god.</div><div> -- The Books of Bokonon</div><div>-------------------------------------------------------------------------------------------------------------------</div>
</span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Park, Sungjin<div>-------------------------------------------------------------------------------------------------------------------</div><div>Peculiar travel suggestions are dancing lessons from god.</div><div> -- The Books of Bokonon</div><div>-------------------------------------------------------------------------------------------------------------------</div>
</div>