From 33cca3ecbc5b69cf6937fd51ae77e888f412779a Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 1 Oct 2021 12:36:02 +0100 Subject: [PATCH] fix jxload restart if the loader was restarted (eg by vipsdisp) it could fail to fetch pixels --- libvips/foreign/jxlload.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libvips/foreign/jxlload.c b/libvips/foreign/jxlload.c index db754f38..ebe3a052 100644 --- a/libvips/foreign/jxlload.c +++ b/libvips/foreign/jxlload.c @@ -2,6 +2,8 @@ * * 18/3/20 * - from heifload.c + * 1/10/21 + * - reset read point for _load */ /* @@ -627,6 +629,17 @@ vips_foreign_load_jxl_load( VipsForeignLoad *load ) if( vips_foreign_load_jxl_set_header( jxl, t[0] ) ) return( -1 ); + /* We have to reset the reader ... we can't reply onb the read point + * being left just after the header. + */ + if( vips_source_rewind( jxl->source ) ) + return( -1 ); + + if( vips_foreign_load_jxl_fill_input( jxl, 0 ) ) + return( -1 ); + JxlDecoderSetInput( jxl->decoder, + jxl->input_buffer, jxl->bytes_in_buffer ); + /* Read to the end of the image. */ do {