Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
806 stars 65 forks source link

RF 07 Skorpion Rifle crash #225

Closed acd2001 closed 5 years ago

acd2001 commented 5 years ago

Start a new game, press ctrl-2 for ammo cheat, seleck RF07 Skorpion Rifle and shot around screen long pressing mouse button and shockolate crash with:

Thread 1 received signal SIGSEGV, Segmentation fault. fr_get_real (cur_fr=0x22ef4c0, x=73, y=-14) at c:/systemshock-master/src/GameSrc/frutil.c:115 115 col = (int)(((cur_fr->draw_canvas.bm.bits) + (y cur_fr->draw_canv as.bm.row) + (x)));

acd2001 commented 5 years ago

Crash happens with various weapons. Just shoot near hud border. immagine1

donnierussellii commented 5 years ago

This code reads a pixel at x,y and returns the object associated with that color. Looks like x,y is going out of bounds. I will make sure by printf'ing the coords.

These kinds of things wouldn't crash DOS so went unnoticed. Just imagine all the passwords you could read without memory protection!

Edit: y coord is going negative. Fix in my PR #226 Tested and crash is gone.

donnierussellii commented 5 years ago

Digging deeper into this...

When I press the right mouse button and drag the pointer off the left or top edge of the 3d view, the weapon fires at a specific point at x=40, y=-20 (something like that), regardless of where the pointer is.

This behavior is also in the 0.6 release.

Edit: Found cause and will fix in a future PR.