SIGSEGV when trying to scroll the screen while displaying line of sight

Issue #116 resolved
loser created an issue

This happens in any sector:

  • press DEL a bunch of times to display cover
  • press and hold END to display LOS -- it will display fine, but the "line of sight" text in the message log won't appear, even though it should
  • while still displaying LOS try to scroll the screen, it will segfault

GDB shows me that the game tries to read from a null pointer at Render_Dirty.cc:581.

Comments (6)

  1. Gennady Trafimenkov repo owner

    Could you please tell me what resolution you are using? It seems I cannot reproduce the problem.

  2. loser reporter

    As I've said in the comment to issue #117, I'm using 1600x900, but this crash also happens on any high resolution. It seems that the higher the resolution the easier it is to cause this crash. It's kind of finicky - you have to display cover or line of sight a bunch of times fast for it to happen. Also, make sure both cover and LOS displays are maximally enlarged.

    I've checked out the code and the segfault happens because the game tries to access fields on a null pointer to a BACKGROUND_SAVE struct in AllocateVideoOverlayArea in Render_Dirty.cc. The pointer itself is set to null because of a bug in SetVideoOverlayPos in the same file. The code there sets that pointer to the return value of a call to RegisterBackgroundRect without checking if it's not null. RegisterBackgroundRect calls GetFreeBackgroundBuffer which throws an exception when it cannot find a free background buffer to return. RegisterBackgroundRect catches that exception and returns NO_BGND_RECT (i.e. NULL) instead.

    Checking whether the pointer returned from RegisterBackgroundRect in SetVideoOverlayPos is null and returning without overwriting it makes the crash go away but causes minor graphical glitches whilst scrolling. Setting the BACKGROUND_BUFFERS #define to a higher value also makes the crash go away on 1600x900 and doesn't cause the graphical glitches, but it doesn't seem like a good enough fix by itself, since the number of background buffers needed appears to be higher the higher the resolution.

  3. Rinne

    I have tried to reproduce this bug for some at 1920x1080 fullscreen 1600x900 fullscreen 1600x900 window mode

    on an Amd Radeon 6770M and an Intel HD3000 both by following your instructions and by going completely mad at the keyboard.

    I could not reproduce it. Could it be a system / driver issue?

  4. loser reporter

    That's really odd. I'm using a GeForce GTX 275 and I get it both on Windows 8 and Ubuntu 13.10. I've played around with it more and it seems that you don't even need to go crazy with the keyboard. I just press Delete a bunch of times to display cover and it works fine. Oddly, the "Display cover" messages don't appear the first few times. Then, the "display cover" message appears - it still displays the cover fine. I keep pressing, the messages keep appearing until an empty message moves the previous messages up. The cover still displays fine, but when I try to scroll now I get a segfault.

    Make sure that you have set the cover/LOS display area to max value.

    If you try that and it still doesn't happen I'll upload an example vid.

  5. Gennady Trafimenkov repo owner

    Make sure that you have set the cover/LOS display area to max value

    This is the key. I can repeat this bug and #117 now. Hold END and press + to increase the area.

  6. Log in to comment