mirror of https://github.com/berdav/snappy-fox
Return coherency and signed overflow
This commit is contained in:
parent
1fb3fa4de8
commit
c3aaada8ac
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue