mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Fix OOB Access on PcxDecode.c
This commit is contained in:
parent
124f4bb591
commit
6a83e43247
|
@ -22,10 +22,7 @@ ImagingPcxDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t byt
|
|||
UINT8 n;
|
||||
UINT8* ptr;
|
||||
|
||||
if (strcmp(im->mode, "1") == 0 && state->xsize > state->bytes * 8) {
|
||||
state->errcode = IMAGING_CODEC_OVERRUN;
|
||||
return -1;
|
||||
} else if (strcmp(im->mode, "P") == 0 && state->xsize > state->bytes) {
|
||||
if ((state->xsize * state->bits + 7) / 8 > state->bytes) {
|
||||
state->errcode = IMAGING_CODEC_OVERRUN;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user