-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault in Single Player #1021
Comments
Any bt on the segfault? |
Nothing explicit, it happens during Game Initialization. Here's the full output: https://hastebin.com/gadiyimuye |
If you don't know what could cause this, I'll build it again with the debug flag to try and find out. |
Ok, got it! Line 1341 in e8b5c13
I fixed it by setting all empty strings to |
That’s really weird! The length of an empty string is always (or should always be) 0. What map are you loading and do you have any mods?
… On 28 Aug 2019, at 17:18, Fallstar ***@***.***> wrote:
Ok, got it!
In https://github.com/JACoders/OpenJK/blob/e8b5c135eccb05ddae67e00ff944001f373fddd4/code/game/g_spawn.cpp#L1341 defaultStyles contains 14 correct entries, then only empty strings. Segfault occurs at line 1512 when it tries to get the length of an empty string.
I fixed it by setting all empty strings to z, like the normal style. The game now seems to work fine.
Can you think of a better way to fix it?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yeah, my C++ is rusty so I don't really understand everything, it's not the value from the table that's directly used. It's set by I'm trying to load |
Those aren't empty strings: |
The defaultStyle array only has 14 valid entries currently. When the 15th element is accessed, it returns a null-byte (not an empty string). This commit prevents a segmentation fault by checking whether the returned pointer from G_SpawnString is NULL before calling strlen. Fixes: JACoders#1021
Thank you! I had the same issue and confirm that fixes it |
By the way, it looks like the original code works when compiled as C but not as C++ so this is might be one of those small but significant differences between the two languages. |
This problem seems specific to Linux - I tried to reproduce on macOS but I didn't encounter a crash when starting a new game. I don't have a Linux system available right now to debug this - can we confirm that @vilhelmgray what OS are you running to reproduce the problem? |
I wasn't quite sure why this was occuring, so I opened a StackOverflow question to figure it out. Turns out it might be a regression in the latest version of g++, so I'll open up a bug notice to the developers and report back here what they say. |
This issue is likely the result of a regression in GCC that has fortunately been fixed for GCC version 9.3: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947 |
@vilhelmgray Thanks for the heads up! I was using GCC version 9.1 |
I was using 9.2, so it makes sense, thanks! |
I have a mistake similar to this but PIXELFORMAT: color(24-bits) Z(24-bit) stencil(8-bits) |
My mistake seems to be because of the dates since I tried to compile another engine and it gives me the same error |
@sodomon2 I think your error is different than the original segfault error for this issue page. Open a new Github issue for your error and we can troubleshoot it there. |
Reporting a bug? Please make sure you've given the following information - thanks!
Operating system and version:
Arch Linux, using Wayland
Is this for single player or multiplayer?
Single Player
Description of the bug (and if possible, steps to reproduce the bug):
Segfault when starting a new game, after character creation.
Multiplayer works fine though, so I doubt it's related to my graphical environment configuration.
I built it today using the AUR pkgbuild.
It happens when using both x11 or Wayland driver for SDL.
What did you expect to happen instead?
Start playing.
PS: I don't know if it's relevant, but I get this exact same behavior with Jedi Outcast.
The text was updated successfully, but these errors were encountered: