Fix BMP RLE delta escape reading from wrong file position (#9443)

Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
This commit is contained in:
Kadir Can Ozden 2026-02-21 15:21:48 +03:00 committed by GitHub
parent 02764a0077
commit 4777a0b318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -221,6 +221,11 @@ def test_rle8_eof(file_name: str, length: int) -> None:
im.load()
def test_rle_delta() -> None:
with Image.open("Tests/images/bmp/q/pal8rletrns.bmp") as im:
assert_image_equal_tofile(im, "Tests/images/pal8rletrns.png")
def test_unsupported_bmp_bitfields_layout() -> None:
fp = io.BytesIO(
o32(40) # header size

View File

@ -369,7 +369,7 @@ class BmpRleDecoder(ImageFile.PyDecoder):
bytes_read = self.fd.read(2)
if len(bytes_read) < 2:
break
right, up = self.fd.read(2)
right, up = bytes_read
data += b"\x00" * (right + up * self.state.xsize)
x = len(data) % self.state.xsize
else: