mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-24 21:41:10 +00:00
Fix UBSan Warnings
- memcpy() shouldn't be called with NULL, even if length == 0 - In CMod_LoadBrushSides() j (from in->texinfo) could be -1, which of course is no valid array index
This commit is contained in:
parent
dc7ad65bb0
commit
7ae9655f3a
2 changed files with 3 additions and 2 deletions
|
@ -1532,7 +1532,7 @@ CMod_LoadBrushSides(lump_t *l)
|
|||
Com_Error(ERR_DROP, "Bad brushside texinfo");
|
||||
}
|
||||
|
||||
out->surface = &map_surfaces[j];
|
||||
out->surface = (j >= 0) ? &map_surfaces[j] : &nullsurface;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ SZ_GetSpace(sizebuf_t *buf, int length)
|
|||
void
|
||||
SZ_Write(sizebuf_t *buf, void *data, int length)
|
||||
{
|
||||
memcpy(SZ_GetSpace(buf, length), data, length);
|
||||
if(length > 0)
|
||||
memcpy(SZ_GetSpace(buf, length), data, length);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue