From f0353c599676d694692174e32dc3acee2912b4a0 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 15 May 2022 13:51:31 +1000 Subject: [PATCH] When reading past the end of a scan line, reduce bytes left --- Tests/images/cross_scan_line_truncated.tga | Bin 0 -> 4881 bytes Tests/test_file_tga.py | 4 ++++ src/libImaging/TgaRleDecode.c | 1 + 3 files changed, 5 insertions(+) create mode 100644 Tests/images/cross_scan_line_truncated.tga diff --git a/Tests/images/cross_scan_line_truncated.tga b/Tests/images/cross_scan_line_truncated.tga new file mode 100644 index 0000000000000000000000000000000000000000..cec4357e3acb85ebfc34e88bdbd4d4621670c456 GIT binary patch literal 4881 zcmeIzyA8k~3`NmLmu!%2$YxnRe8dDPC~}O1Tv>4CYp0w^%GIvi?HoN32>h17v-{`u m>jM->Fubuffer + state->x, ptr, n); ptr += n; + bytes -= n; extra_bytes -= n; } }