Fix: properly check disabled items against segfaults#868
Open
metaq3 wants to merge 1 commit intoioquake:mainfrom
Open
Fix: properly check disabled items against segfaults#868metaq3 wants to merge 1 commit intoioquake:mainfrom
metaq3 wants to merge 1 commit intoioquake:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue
I'm using native libraries. On some maps that have "teamed" items, where some of them are disabled through
disable_<item>cvar, there's always a chance of the server crashing withSIGSEGV. Usinggivecommand to obtain disabled item also leads to segmentation violation.Qvm on that matter just spawns nothing until the end of the match, but using
givecommand will still crash the game.Reliable way to reproduce
Build native libraries and copy them into
baseq3.Map
q3ctf3has "teamed" items at the center of the map ( quad, regeneration and invisibility, which are chosen randomly on powerup respawn ). Disable regeneration and invisibility.Here's command to start such server:
Restart the map with
map_restart, go to the center of the map, where powerups are spawned, and pickup quad until the server crashes. I sped up the game withsv_fps 250andtimescale 100, so I can observe crash within 10 seconds after standing at one place.The fix
When an item is disabled, any entity of that item will have nullish
ent->item. Currently, I check for this as another spawning condition ( untilforceSpawnis set ). Making it so requires user to restart the map each time they disable/enable items on the server, which is vanilla behaviour, but I would personally suggest against requiring map restart to apply the changes. As I see, it can be done by checking every couple of ticks whether an item has been enabled to spawn it or to prevent it from spawning if it has been disabled. It would also make code cleaner, asG_ItemDisabledsays more to the reader than!ent->itemcheck.But still, waiting for your opinions and review. Would be glad to get any!