View Full Version : Presumed buffer overflow when printing/logging very long lines

01-09-2007, 02:10 AM
now I will hax your computer with my mad skillz!1 :mad:

I accidentally caused Novashell to crash (from what I assume is a buffer overflow) when print()ing a very large string (4046 characters or more).

function MakeAReallyHonkingBigStringMan(ginormousness)
local result = ""
for i = 1, ginormousness do
result = result .. "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx" -- 64 exes
return result

MakeAReallyHonkingBigStringMan(63) -- no crash
MakeAReallyHonkingBigStringMan(64) -- CRASH

(I was actually printing a table at the time, but this should work too.)

D'oh, I just realized that I could have used string.rep() had I known it existed at the time. Oh well.