Return coherency and signed overflow

This commit is contained in:
Davide Berardi 2021-01-26 17:23:03 +01:00
parent 1fb3fa4de8
commit c3aaada8ac
1 changed files with 4 additions and 1 deletions

View File

@ -111,8 +111,11 @@ static int32_t parse_literal(uint8_t *cdata, uint32_t cidx, uint32_t clength,
return -1;
lenval = (int32_t)lenval_u;
if (*idx > length || clen > length)
return -1;
if (*idx + clen > length)
return -9;
return -1;
prdebug("Copying literal %d bytes at (u:%d c:%d (%lu))\n",
clen, *idx, offsetval, offsetval);