1
0
mirror of https://github.com/berdav/snappy-fox synced 2025-06-05 21:59:21 +02:00

Return coherency and signed overflow

This commit is contained in:
2021-01-26 17:23:03 +01:00
parent 1fb3fa4de8
commit c3aaada8ac

View File

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