pcx: make palette marker optional

This commit is contained in:
Denis Pauk 2024-08-31 13:18:00 +03:00
parent a7cb9431b3
commit a2536cc735
2 changed files with 14 additions and 2 deletions

View file

@ -265,9 +265,15 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
return; return;
} }
if ((len > 768) && (((byte *)pcx)[len - 769] == 0x0C)) if (len > 768)
{ {
memcpy(*palette, (byte *)pcx + len - 768, 768); memcpy(*palette, (byte *)pcx + len - 768, 768);
if ((((byte *)pcx)[len - 769] != 0x0C))
{
Com_DPrintf("%s: %s has no palette marker\n",
__func__, name);
}
} }
else else
{ {

View file

@ -340,9 +340,15 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
return; return;
} }
if ((len > 768) && (((byte *)pcx)[len - 769] == 0x0C)) if (len > 768)
{ {
memcpy(*palette, (byte *)pcx + len - 768, 768); memcpy(*palette, (byte *)pcx + len - 768, 768);
if ((((byte *)pcx)[len - 769] != 0x0C))
{
R_Printf(PRINT_DEVELOPER, "%s: %s has no palette marker\n",
__func__, name);
}
} }
else else
{ {