mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'warn-invalid-texture-data' into 'master'
Single-patch textures: print an error if patch header is missing, cease memory errors See merge request KartKrew/Kart!1190
This commit is contained in:
commit
344f51d384
1 changed files with 21 additions and 0 deletions
|
|
@ -295,6 +295,27 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
wadnum = patch->wad;
|
wadnum = patch->wad;
|
||||||
lumpnum = patch->lump;
|
lumpnum = patch->lump;
|
||||||
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
|
|
||||||
|
// The header does not exist
|
||||||
|
if (lumplength < offsetof(softwarepatch_t, columnofs))
|
||||||
|
{
|
||||||
|
CONS_Alert(
|
||||||
|
CONS_ERROR,
|
||||||
|
"%.8s: texture lump data is too small. Expected %s bytes, got %s. (%s)\n",
|
||||||
|
texture->name,
|
||||||
|
sizeu1(offsetof(softwarepatch_t, columnofs)),
|
||||||
|
sizeu2(lumplength),
|
||||||
|
wadfiles[wadnum]->lumpinfo[lumpnum].fullname
|
||||||
|
);
|
||||||
|
|
||||||
|
// Allocate dummy data. Keep 4-bytes aligned.
|
||||||
|
// Column offsets will be initialized to 0, which points to the 0xff byte (empty column flag).
|
||||||
|
block = Z_Calloc(4 + (texture->width * 4), PU_CACHE, &texturecache[texnum]);
|
||||||
|
block[0] = 0xff;
|
||||||
|
texturecolumnofs[texnum] = (UINT32*)&block[4];
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||||
realpatch = (softwarepatch_t *)pdata;
|
realpatch = (softwarepatch_t *)pdata;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue