mirror of
https://github.com/fadden/nulib2.git
synced 2024-06-11 22:29:53 +00:00
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) {
|
if (uch == rleEscape) {
|
||||||
uch = *inbuf++;
|
uch = *inbuf++;
|
||||||
count = *inbuf++;
|
count = *inbuf++;
|
||||||
|
if (outbuf + count >= outbufend) {
|
||||||
|
/* don't overrun buffer */
|
||||||
|
Assert(outbuf != outbufend);
|
||||||
|
break;
|
||||||
|
}
|
||||||
while (count-- >= 0)
|
while (count-- >= 0)
|
||||||
*outbuf++ = uch;
|
*outbuf++ = uch;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user