From f1d2d4030ef0a69e67731e4102ea7d02661f1ed2 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 9 Oct 2020 14:02:53 +0100 Subject: [PATCH 1/2] fix build with libheif save buit not load We had some definitions inside the #ifdef HEIFLOAD. Thanks estepnv https://github.com/libvips/libvips/issues/1844 --- ChangeLog | 1 + libvips/foreign/heifload.c | 38 ++++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4bee120..aabfc1df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ - improve seek behaviour on pipes - add "speed" param to heifsave [lovell] - fix regression in C path for dilate / erode [kleisauke] +- fix build with libheif save but no load [estepnv] 9/8/20 started 8.10.1 - fix markdown -> xml conversion in doc generation diff --git a/libvips/foreign/heifload.c b/libvips/foreign/heifload.c index 802fdc66..494a2e37 100644 --- a/libvips/foreign/heifload.c +++ b/libvips/foreign/heifload.c @@ -68,12 +68,33 @@ #include #include -#ifdef HAVE_HEIF_DECODER +/* These are shared with the encoder. + */ +#if defined(HAVE_HEIF_DECODER) || defined(HAVE_HEIF_ENCODER) #include #include "pforeign.h" +void +vips__heif_error( struct heif_error *error ) +{ + if( error->code ) + vips_error( "heif", "%s (%d.%d)", error->message, error->code, + error->subcode ); +} + +const char *vips__heif_suffs[] = { + ".heic", + ".heif", + ".avif", + NULL +}; + +#endif /*defined(DECODE) || defined(ENCODE)*/ + +#ifdef HAVE_HEIF_DECODER + #define VIPS_TYPE_FOREIGN_LOAD_HEIF (vips_foreign_load_heif_get_type()) #define VIPS_FOREIGN_LOAD_HEIF( obj ) \ (G_TYPE_CHECK_INSTANCE_CAST( (obj), \ @@ -200,14 +221,6 @@ vips_foreign_load_heif_dispose( GObject *gobject ) dispose( gobject ); } -void -vips__heif_error( struct heif_error *error ) -{ - if( error->code ) - vips_error( "heif", "%s (%d.%d)", error->message, error->code, - error->subcode ); -} - static int vips_foreign_load_heif_build( VipsObject *object ) { @@ -1055,13 +1068,6 @@ vips_foreign_load_heif_file_is_a( const char *filename ) return( vips_foreign_load_heif_is_a( buf, 12 ) ); } -const char *vips__heif_suffs[] = { - ".heic", - ".heif", - ".avif", - NULL -}; - static void vips_foreign_load_heif_file_class_init( VipsForeignLoadHeifFileClass *class ) { From b1e636346a3ffeee5b6c05945d52f1804bd62afb Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 18 Oct 2020 22:36:15 +0100 Subject: [PATCH 2/2] relax is_a heic test rules 32 was a little too small, see https://github.com/libvips/libvips/issues/1861 --- ChangeLog | 3 +++ configure.ac | 6 +++--- libvips/foreign/heifload.c | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index aabfc1df..9d95d62e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +18/10/20 started 8.10.3 +- relax heic is_a rules [hisham] + 6/9/20 started 8.10.2 - update magicksave/load profile handling [kelilevi] - better demand hint rules [kaas3000] diff --git a/configure.ac b/configure.ac index ea3224a6..6f6dc956 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [8.10.2], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [8.10.3], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [8]) m4_define([vips_minor_version], [10]) -m4_define([vips_micro_version], [2]) +m4_define([vips_micro_version], [3]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r $srcdir/ChangeLog` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=54 -LIBRARY_REVISION=4 +LIBRARY_REVISION=5 LIBRARY_AGE=12 # patched into include/vips/version.h diff --git a/libvips/foreign/heifload.c b/libvips/foreign/heifload.c index 494a2e37..fc98bc07 100644 --- a/libvips/foreign/heifload.c +++ b/libvips/foreign/heifload.c @@ -271,7 +271,7 @@ static const char *heif_magic[] = { * * enum heif_filetype_result result = heif_check_filetype( buf, 12 ); * - * but it's very conservative and seems to be missing some of the Nokia hief + * but it's very conservative and seems to be missing some of the Nokia heif * types. */ static int @@ -282,7 +282,10 @@ vips_foreign_load_heif_is_a( const char *buf, int len ) int i; - if( chunk_len > 32 || + /* We've seen real files with 36 here, so 64 should be + * plenty. + */ + if( chunk_len > 64 || chunk_len % 4 != 0 ) return( 0 );