From e2c50d07c6b337ea4785301f14226d14c9b36c42 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 11 May 2022 22:28:34 +0100 Subject: [PATCH 1/2] fix ssize_t / ssize_t confusion --- libvips/foreign/jpeg2vips.c | 6 +++--- libvips/foreign/pdfiumload.c | 9 +++++---- libvips/iofuncs/sbuf.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index 318fcd5f..281ffeda 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -243,12 +243,12 @@ source_fill_input_buffer( j_decompress_ptr cinfo ) Source *src = (Source *) cinfo->src; - size_t read; + gint64 bytes_read; - if( (read = vips_source_read( src->source, + if( (bytes_read = vips_source_read( src->source, src->buf, SOURCE_BUFFER_SIZE )) > 0 ) { src->pub.next_input_byte = src->buf; - src->pub.bytes_in_buffer = read; + src->pub.bytes_in_buffer = bytes_read; } else { if( src->jpeg->fail_on >= VIPS_FAIL_ON_TRUNCATED ) diff --git a/libvips/foreign/pdfiumload.c b/libvips/foreign/pdfiumload.c index 4b0c3c93..0f76ec91 100644 --- a/libvips/foreign/pdfiumload.c +++ b/libvips/foreign/pdfiumload.c @@ -236,12 +236,13 @@ vips_pdfium_GetBlock( void *param, return( FALSE ); while( size > 0 ) { - size_t n_read; + gint64 bytes_read; - if( (n_read = vips_source_read( pdf->source, pBuf, size )) < 0 ) + if( (bytes_read = + vips_source_read( pdf->source, pBuf, size )) < 0 ) return( FALSE ); - pBuf += n_read; - size -= n_read; + pBuf += bytes_read; + size -= bytes_read; } return( TRUE ); diff --git a/libvips/iofuncs/sbuf.c b/libvips/iofuncs/sbuf.c index 1a366000..69a3e714 100644 --- a/libvips/iofuncs/sbuf.c +++ b/libvips/iofuncs/sbuf.c @@ -270,10 +270,10 @@ vips_sbuf_require( VipsSbuf *sbuf, int require ) int space_available = VIPS_SBUF_BUFFER_SIZE - sbuf->chars_in_buffer; - size_t bytes_read; + gint64 bytes_read; if( (bytes_read = vips_source_read( sbuf->source, - to, space_available )) == -1 ) + to, space_available )) < 0 ) return( -1 ); if( bytes_read == 0 ) { vips_error( From 36cc50500bc407f22a55f054765abd10e89f24f4 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 11 May 2022 22:30:42 +0100 Subject: [PATCH 2/2] update changelog for ssize_t fix --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 165aedf8..2ab2ede1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 26/11/21 started 8.12.3 - better arg checking for hist_find_ndim [travisbell] - fix thumbnail with CMYK output [AdamGaskins] +- fix size_t / ssize_t confusion [flga] 26/11/21 started 8.12.2 - make exif resuint optional and default to inch