Skip to main content
Topic: r2022:all paks:memory corruption (Read 4998 times) previous topic - next topic

r2022:all paks:memory corruption

In schedule_list.cc, there is a static variable named max_id, with an initial value of 0.  That variable is used in schedule_list_gui_t::schedule_list_gui_t as a pointer to the also static array static uint8 tabs_to_lineindex[9];.  The pointer is not reset and so, the second and after calls to that constructor overflows the array and corrupts memory.

The symptoms in my Linux are the following: after opening and closing several times the Lines information window and trying to open and information window of a factory, there is a segmentation fault.  But these symptoms may vary from compiler to compiler, and from system to system.

Perhaps, a solution is to add this line at schedule_list.cc:105:
max_id=0;


Re: r2022:all paks:memory corruption

Reply #1
Hey, this might be the reason for the problems mentioned in r2000 + pak64 on WinXp, Random Crashes, because the info window for factories is involved there, too.

Re: r2022:all paks:memory corruption

Reply #2
It may be.  But it seems strange to me that different compilers and OSes corrupts the same zone of the memory.  The source of the error would be the same (opening the lines information window several times), but the outcome may or not may be the same, I think...


Re: r2022:all paks:memory corruption

Reply #3
Thank you, good catch.

Re: r2022:all paks:memory corruption

Reply #4
You're welcome.

Nice you're back.

 

Re: r2022:all paks:memory corruption

Reply #5
(Closing as solved.)