mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-07 07:22:54 +00:00
I_Error if ENCORE/TWEAKMAP has an incorrect size
Prevent memory errors if the lump is too large.
This commit is contained in:
parent
954127d533
commit
6bc785c099
2 changed files with 9 additions and 0 deletions
|
|
@ -7877,6 +7877,13 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
|
||||
if (encoreLump)
|
||||
{
|
||||
if (encoreLump->size != 256)
|
||||
{
|
||||
I_Error("%s: %s lump is not 256 bytes (actual size %s bytes)\n"
|
||||
"Make sure the lump is in DOOM Flat or SRB2 Encore format and 16x16",
|
||||
maplumpname, encoreLump->name, sizeu1(encoreLump->size));
|
||||
}
|
||||
|
||||
R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette, encoreLump->data, encoreLump->size);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -314,6 +314,8 @@ void R_ReInitColormaps(UINT16 num, void *newencoremap, size_t encoremapsize)
|
|||
lighttable_t *colormap_p, *colormap_p2;
|
||||
size_t p, i;
|
||||
|
||||
I_Assert(encoremapsize == 256);
|
||||
|
||||
encoremap = Z_MallocAlign(256 + 10, PU_LEVEL, NULL, 8);
|
||||
M_Memcpy(encoremap, newencoremap, encoremapsize);
|
||||
colormap_p = colormap_p2 = colormaps;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue