mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Simplified code as both values are 7 bit
This commit is contained in:
parent
14b9b597ff
commit
17d342bc4b
|
@ -42,15 +42,13 @@ ImagingTgaRleDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t
|
||||||
return ptr - buf;
|
return ptr - buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n = depth * ((ptr[0] & 0x7f) + 1);
|
||||||
if (ptr[0] & 0x80) {
|
if (ptr[0] & 0x80) {
|
||||||
/* Run (1 + pixelsize bytes) */
|
/* Run (1 + pixelsize bytes) */
|
||||||
|
|
||||||
if (bytes < 1 + depth) {
|
if (bytes < 1 + depth) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = depth * ((ptr[0] & 0x7f) + 1);
|
|
||||||
|
|
||||||
if (state->x + n > state->bytes) {
|
if (state->x + n > state->bytes) {
|
||||||
state->errcode = IMAGING_CODEC_OVERRUN;
|
state->errcode = IMAGING_CODEC_OVERRUN;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -67,11 +65,8 @@ ImagingTgaRleDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t
|
||||||
|
|
||||||
ptr += 1 + depth;
|
ptr += 1 + depth;
|
||||||
bytes -= 1 + depth;
|
bytes -= 1 + depth;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Literal (1+n+1 bytes block) */
|
/* Literal (1+n+1 bytes block) */
|
||||||
n = depth * (ptr[0] + 1);
|
|
||||||
|
|
||||||
if (bytes < 1 + n) {
|
if (bytes < 1 + n) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user