From 0b3ab3a934cf8c129986d5dd450bcc10f44db5b0 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 11 Sep 2022 14:26:53 +0100 Subject: [PATCH 1/4] fix null string in buffer print Some libvips header fields can be NULL, for example filename, and we need to avoid null pointer deref on print. See https://github.com/libvips/libvips/issues/3043 --- libvips/iofuncs/buf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libvips/iofuncs/buf.c b/libvips/iofuncs/buf.c index 3061981a..19be0a91 100644 --- a/libvips/iofuncs/buf.c +++ b/libvips/iofuncs/buf.c @@ -262,6 +262,8 @@ vips_buf_appendns( VipsBuf *buf, const char *str, int sz ) if( buf->full ) return( FALSE ); + if( !str ) + return( TRUE ); /* Amount we want to copy. */ @@ -528,7 +530,7 @@ vips_buf_appendgv( VipsBuf *buf, GValue *value ) * handled by boxed, see below. */ str = g_value_get_string( value ); - result = vips_buf_appends( buf, str ); + result = vips_buf_appends( buf, str ); handled = TRUE; } break; From 63f1673beb617221550ada5deb246d0cfa43823a Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 11 Sep 2022 14:30:09 +0100 Subject: [PATCH 2/4] note buffer print fix --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index e14046b6..8fb6cdf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 5/9/22 started 8.13.2 - in dzsave, add add missing include directive for errno/EEXIST [kleisauke] - fix 8 bit pallete PNG save [lovell] +- fix null string in buffer print [pclewis] 24/7/22 started 8.13.1 - fix im7 feature detection in meson From 6bf1422548bad354e1b54a677e0a09b45102987a Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Wed, 14 Sep 2022 14:40:40 +0200 Subject: [PATCH 3/4] jxlsave: sync quality to distance calculation with libjxl (#3050) Ensures the quality to distance conversion is continuous at 30. See: https://github.com/libjxl/libjxl/commit/ea5fa8074d0146ec0f4388f52990d428ea3b67c3 --- libvips/foreign/jxlsave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvips/foreign/jxlsave.c b/libvips/foreign/jxlsave.c index 9c49b95d..f374abee 100644 --- a/libvips/foreign/jxlsave.c +++ b/libvips/foreign/jxlsave.c @@ -249,7 +249,7 @@ vips_foreign_save_jxl_build( VipsObject *object ) if( !vips_object_argument_isset( object, "distance" ) ) jxl->distance = jxl->Q >= 30 ? 0.1 + (100 - jxl->Q) * 0.09 : - 6.4 + pow(2.5, (30 - jxl->Q) / 5.0f) / 6.25f; + 6.24 + pow(2.5, (30 - jxl->Q) / 5.0f) / 6.25f; /* Distance 0 is lossless. libjxl will fail for lossy distance 0. */ From 907d17cd063d2c6e902aff431c907a7ec3e61985 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 20 Sep 2022 10:03:00 +0100 Subject: [PATCH 4/4] revise caching of seq mode loaders We were not caching seq mode loaders used in random access mode. see https://github.com/libvips/libvips/issues/3044 --- ChangeLog | 1 + libvips/foreign/foreign.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fb6cdf8..9a043a0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - in dzsave, add add missing include directive for errno/EEXIST [kleisauke] - fix 8 bit pallete PNG save [lovell] - fix null string in buffer print [pclewis] +- revise caching of seq mode loaders [jcupitt] 24/7/22 started 8.13.1 - fix im7 feature detection in meson diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 1d35c954..eeadfe8c 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1044,7 +1044,6 @@ vips_foreign_load_build( VipsObject *object ) VipsForeignLoadClass *fclass = VIPS_FOREIGN_LOAD_GET_CLASS( object ); VipsForeignFlags flags; - gboolean sequential; #ifdef DEBUG printf( "vips_foreign_load_build:\n" ); @@ -1064,14 +1063,12 @@ vips_foreign_load_build( VipsObject *object ) g_object_set( load, "flags", flags, NULL ); - /* Seq access has been requested, or the loader requires seq. + /* We must block caching of seq loaders running in seq mode. A seq + * loader in random mode is fine, since we'll read to ram or a temp + * file. */ - sequential = (load->flags & VIPS_FOREIGN_SEQUENTIAL) || - load->access != VIPS_ACCESS_RANDOM; - - /* We must block caching of seq loads. - */ - if( sequential ) + if( (load->flags & VIPS_FOREIGN_SEQUENTIAL) && + load->access != VIPS_ACCESS_RANDOM ) load->nocache = TRUE; /* The deprecated "fail" field sets fail_on warning. @@ -1134,9 +1131,9 @@ vips_foreign_load_build( VipsObject *object ) return( -1 ); } - /* Tell downstream if we are reading sequentially. + /* Tell downstream if seq mode was requested. */ - if( sequential ) + if( load->access != VIPS_ACCESS_RANDOM ) vips_image_set_int( load->out, VIPS_META_SEQUENTIAL, 1 ); return( 0 );