mirror of https://github.com/fadden/nulib2.git
Test for buffer overrun when unpacking RLE.
This commit is contained in:
parent
cced2e7ab4
commit
8aab8caff1
|
@ -1248,6 +1248,11 @@ Nu_ExpandRLE(LZWExpandState* lzwState, const uchar* inbuf,
|
|||
if (uch == rleEscape) {
|
||||
uch = *inbuf++;
|
||||
count = *inbuf++;
|
||||
if (outbuf + count >= outbufend) {
|
||||
/* don't overrun buffer */
|
||||
Assert(outbuf != outbufend);
|
||||
break;
|
||||
}
|
||||
while (count-- >= 0)
|
||||
*outbuf++ = uch;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue