<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 26, 2014 at 12:00 PM, Vajrasky Kok <span dir="ltr"><<a href="mailto:sky.kok@speaklikeaking.com" target="_blank">sky.kok@speaklikeaking.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":146" style="overflow:hidden">>>> repeat('a', times=-1)<br>
repeat('a')</div></blockquote></div><br>As I think about it, this may be more than a bug but a door for a denial of service attack.   Imagine an application where times comes from an untrusted source.  Someone relying on documented behavior may decide to sanitize the value by only checking against an upper bound assuming that negative values would just lead to no repetitions.  If an attacker could somehow case times to get the value of -1 this may cause an infinite loop, blow up memory etc.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">If you think this is far-fetched - consider a web app that uses repeat() as a part of logic to pretty-print user input.  The times value may come from a calculation of a difference between the screen width and the length of some string - both under user control.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">So maybe the fix should go into security bugs only branches as well.</div><div class="gmail_extra"><br></div></div>