light: Mod_Q1BSP_DecompressVis: port safety check from DecompressRow

This commit is contained in:
Eric Wasylishen 2023-01-08 14:36:52 -07:00
parent ee5c016b57
commit 2b8f8c826d
1 changed files with 7 additions and 1 deletions

View File

@ -465,7 +465,13 @@ static void Mod_Q1BSP_DecompressVis(const uint8_t *in, const uint8_t *inend, uin
return;
}
for (c = *in++; c > 0; c--) {
const int run_length = *in++;
if (!run_length) {
logging::print("Mod_Q1BSP_DecompressVis: 0 repeat\n");
return;
}
for (c = run_length; c > 0; c--) {
if (out == outend) {
logging::print("Mod_Q1BSP_DecompressVis: output overrun (decompressed {} of {} output bytes)\n",
(out - outstart), (outend - outstart));