Fix for endless loop bug in Z_Malloc and flood-protect fix for amtele/amtelemark #146
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.
Consists of 2 things.
RE_RegisterImages_LevelLoadEnd always returns qtrue atm, due to a variable being wrongly initialized, causing endless loops when called from Z_Alloc. Z_Alloc wants to find ways to free memory... asks RE_RegisterImages_LevelLoadEnd to do so. RE_RegisterImages_LevelLoadEnd reports back that an image was deleted (qtrue) even if no image was deleted. Z_Alloc then thinks ok, let's retry the malloc... endless loop, for hours even, forcing you to quit the process instead of gracefully erroring and disconnecting. You can compare this to the behavior of the original released jka code, it's only supposed to return qtrue if an image was actually deleted, else Z_Alloc can never fall through to the lower down conditions to either delete other stuff like models/sounds or actually gracefully quit. The error was introduced in this commit:
d405b33
Currently amtele/amtelemark is always not ratelimited if sv_newFloodProtect is >1. This may not be desired as in some circumstances people could abuse it to spam teleport sounds/effects. Proposed solution here is to only disable ratelimiting for amtele/amtelemark if sv_newFloodProtect is >2, and otherwise fall back to the old behavior. This allows the old behavior to be restored before the amtele exception was formerly introduced in this commit:
ef4648a