From 81c92242d8e6cdde1c8f2b4814b0a9ab0b3f1d7f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 21 Aug 2019 17:42:25 +0100 Subject: [PATCH 1/2] relax HEIC threshold libheic versions change rounding behaviour --- test/test-suite/test_foreign.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-suite/test_foreign.py b/test/test-suite/test_foreign.py index 4d8501b6..0ef1e2b6 100644 --- a/test/test-suite/test_foreign.py +++ b/test/test-suite/test_foreign.py @@ -830,7 +830,7 @@ class TestForeign: def test_heifload(self): def heif_valid(im): a = im(10, 10) - assert_almost_equal_objects(a, [75.0, 86.0, 81.0]) + assert_almost_equal_objects(a, [75.0, 86.0, 81.0], threshold=2) assert im.width == 4032 assert im.height == 3024 assert im.bands == 3 From 4b677fb16a95f11ee1fe02502b1565cfc3d2ad19 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 23 Aug 2019 15:40:48 +0100 Subject: [PATCH 2/2] make GIF parse less strict Some GIFs don't follow the standard very closely. Let them through. See https://github.com/libvips/libvips/issues/1404 --- ChangeLog | 1 + libvips/foreign/gifload.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42848727..870ff49b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ - fix build with MSVC - fix a problem with shinkv tail processing [angelmixu] - fix a read one byte beyond buffer bug in jpegload +- make GIF parsing less strict 24/5/19 started 8.8.1 - improve realpath() use on older libc diff --git a/libvips/foreign/gifload.c b/libvips/foreign/gifload.c index 122e5f40..a76ba040 100644 --- a/libvips/foreign/gifload.c +++ b/libvips/foreign/gifload.c @@ -22,6 +22,8 @@ * - init pages to 0 before load * 14/2/19 * - rework as a sequential loader ... simpler, much lower mem use + * 23/8/18 + * - allow GIF read errors during header scan */ /* @@ -601,11 +603,12 @@ vips_foreign_load_gif_header( VipsForeignLoad *load ) gif->n_pages = 0; - do { - if( DGifGetRecordType( gif->file, &record ) == GIF_ERROR ) { - vips_foreign_load_gif_error( gif ); - return( -1 ); - } + do { + /* Don't flag errors during header scan. Some corrupt GIFs + * will fail. + */ + if( DGifGetRecordType( gif->file, &record ) == GIF_ERROR ) + continue; switch( record ) { case IMAGE_DESC_RECORD_TYPE: