ValveSoftware / csgo-demoinfo

CS:GO demo parsing tool
BSD 2-Clause "Simplified" License
489 stars 101 forks source link

x64 build throws malloc errors #19

Open WillBrindle opened 7 years ago

WillBrindle commented 7 years ago

This wouldn't run correctly for me on OS X 64-bit without the 32-bit compiler flag (-m32). I believe it comes down to line 397 in demofilebitbuf.cpp. Size of 32 is hard coded for some things but we convert to an unsigned long and move pOut by that much, which when built for 64-bit is 64 bits, and therefore write to more memory than we assigned. I believe just using an int in its place should work and appears to work.

Is this only designed for 32-bit architecture? Are other things likely to go wrong with this fix? I have briefly tested out putting game events and it appeared to work as expected.

bugdone commented 7 years ago

Hi Will,

this commit https://github.com/abenea/demoinfogo-linux/commit/da17ab2b0cef6f4cbd98c01df5ecb3cc3c26edcc might help