Codefix: Avoid divide by 0 in div/mod type varaction2 adjusts (#13123)

This commit is contained in:
Jonathan G Rennison 2024-11-27 23:24:46 +00:00 committed by GitHub
parent 23e252ad40
commit f5a6a31e4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5254,6 +5254,7 @@ static void NewSpriteGroup(ByteReader &buf)
if (adjust.type != DSGA_TYPE_NONE) {
adjust.add_val = buf.ReadVarSize(varsize);
adjust.divmod_val = buf.ReadVarSize(varsize);
if (adjust.divmod_val == 0) adjust.divmod_val = 1; // Ensure that divide by zero cannot occur
} else {
adjust.add_val = 0;
adjust.divmod_val = 0;