Lua bug - stack overflow

A bug with Lua 5.1 means that creating string patterns which are too long can cause a stack overflow; this was fixed in Lua 5.2 (it now outputs ‘pattern too complex’ or similar) - the problem is, this can actually crash ROBLOX. That is, whatever side it is ran on; the server-side or the client side. It would just force the client to say “An unexpected error has occured and ROBLOX needs to quit! We’re sorry!” and crash a server.

I’m not sure where the bug is, but I’m pretty sure you can fix it by looking at the pattern matching functions in Lua (string.find, string.gmatch, string.match, string.gsub, etc) and looking at how they altered them in 5.2.

The precise code I used to cause this crash is this:

print(string.find(string.rep("a", 2^20), string.rep(".?", 2^20)))

The reason why I want this patched is because malicious people who get server-side access due to exploits (Kohl’s admin, loadstring exploit etc) can use this as a last-attempt to ditch the server they’re on and cause a bunch of people to leave. When 100 player servers come out, this could potentially kick a game off the front page.

While this is a bug, I don’t see how it is critical to fix. If you have loadstring enabled and an exploiter has server-sided Lua access then you have much bigger things to worry about.
Messing up your datastore, possibly being able to steal your game, and destroying the game simply by Remove-ing your game scripts all can happen, which is more important then just ending the game. It’s worth noting that Roblox is already very easy to crash without any internal Lua bugs - you could just put while Delay(0,function() end) do end and it will crash the server, along with tens of other ways to do it.

That’s a while loop; of course it will crash the server without some sort of yielding.

My point is, this doesn’t contain any while loops, and the stack overflow it causes cannot be handled easily.

The point is that there are endless ways to crash game servers and it’s not worth backporting a bug fix just to patch one of them.