From aeb549ef8f4cb939c6dcfb36047712571282f6be Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 28 Dec 2021 17:38:01 +1100 Subject: [PATCH] Fixed unpacking I;16B to I;16 on big endian --- Tests/test_file_png.py | 2 -- src/libImaging/Pack.c | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 9a5577bbac0..0869cc58bc5 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -13,7 +13,6 @@ assert_image_equal, assert_image_equal_tofile, hopper, - is_big_endian, is_win32, mark_if_feature_version, skip_unless_feature, @@ -77,7 +76,6 @@ def get_chunks(self, filename): png.crc(cid, s) return chunks - @pytest.mark.xfail(is_big_endian(), reason="Fails on big-endian") def test_sanity(self, tmp_path): # internal version number diff --git a/src/libImaging/Pack.c b/src/libImaging/Pack.c index 2fdee919f6c..0c7c0497efe 100644 --- a/src/libImaging/Pack.c +++ b/src/libImaging/Pack.c @@ -656,7 +656,11 @@ static struct { /* storage modes */ {"I;16", "I;16", 16, copy2}, +#ifdef WORDS_BIGENDIAN + {"I;16", "I;16B", 16, packI16N_I16}, +#else {"I;16", "I;16B", 16, packI16N_I16B}, +#endif {"I;16B", "I;16B", 16, copy2}, {"I;16L", "I;16L", 16, copy2}, {"I;16", "I;16N", 16, packI16N_I16}, // LibTiff native->image endian.