JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.01k stars 612 forks source link

Crash when viewing demos page with too many levels of folders #619

Closed ghost closed 9 years ago

ghost commented 9 years ago

When I got a couple of folders with demos located (tested) in them and got some longer names (not tested but others experienced this), then openjk entirely crashes (freeze, standard windows error message) when you hit "play demo" in the main menu.

I worked around this by removing all folders in the demo folder. But it would be great if it could be looked at.

ghost commented 9 years ago

An example of the folder structure would be: http://i.imgur.com/eFl9WsB.png Again though, I can not confirm the exact cause. Only that it crashes, and doesn't when I remove the folder structure. I only heard other people also had the same issue with the length of names. That's all.

edit: ignore the 'demos archive 2016'. It should be 'demos', I replaced it temporarily.

ghost commented 9 years ago

Update: was able to reproduce the issue by placing folders in folders like so: http://i.imgur.com/AVCvUWj.jpg

ghost commented 9 years ago

All .zip files and jk2 demos that were in the demos folder, did not make my game crash. Nor did weird long names (so far). But a couple of folders in folders did.

xycaleth commented 9 years ago

I had a quick look, and the issue is caused due to a stack overflow in UI_LoadDemosInDirectory. It seems that after too many recursions, we run out of stack space :/ We should probably allocate some of the memory on the heap.