mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 19:45:56 +03:00
Fix Out of bounds read when saving GIF of xsize=1
This commit is contained in:
parent
2d7c543a2f
commit
d96945b7c8
|
@ -74,10 +74,10 @@ def test_optimize():
|
||||||
im.save(test_file, "GIF", optimize=optimize)
|
im.save(test_file, "GIF", optimize=optimize)
|
||||||
return len(test_file.getvalue())
|
return len(test_file.getvalue())
|
||||||
|
|
||||||
assert test_grayscale(0) == 800
|
assert test_grayscale(0) == 799
|
||||||
assert test_grayscale(1) == 44
|
assert test_grayscale(1) == 43
|
||||||
assert test_bilevel(0) == 800
|
assert test_bilevel(0) == 799
|
||||||
assert test_bilevel(1) == 800
|
assert test_bilevel(1) == 799
|
||||||
|
|
||||||
|
|
||||||
def test_optimize_correctness():
|
def test_optimize_correctness():
|
||||||
|
|
|
@ -233,6 +233,13 @@ ImagingGifEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* Potential special case for xsize==1 */
|
||||||
|
if (state->x < state->xsize) {
|
||||||
|
this = state->buffer[state->x++];
|
||||||
|
} else {
|
||||||
|
EMIT_RUN(label0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this = state->buffer[state->x++];
|
this = state->buffer[state->x++];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user