diff --git a/ChangeLog b/ChangeLog index a831042c..5b0c988e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ - don't seek on bad file descriptors [kleisauke] - check for null memory sources [kleisauke] - revise ppmload, fixing a couple of small bugs +- signal error on EOF in jpegload more reliably [bozaro] 18/12/20 started 8.10.5 - fix potential /0 in animated webp load [lovell] diff --git a/configure.ac b/configure.ac index a14ffa81..4d66bece 100644 --- a/configure.ac +++ b/configure.ac @@ -141,24 +141,6 @@ AM_CONDITIONAL(ENABLE_DEPRECATED, [test x"$enable_deprecated" = x"yes"]) # this gets pasted into version.h as a #define AC_SUBST(VIPS_ENABLE_DEPRECATED) -# we are a C library with some optional C++ components inside it - -# on most platforms, but not all, we just include -lstdc++ in the link line -# for programs - -# we ought to have a proper configure test for this :( - -AC_MSG_CHECKING([for needs -lstdc++]) -case "$host_os" in - freebsd*) - vips_needs_stdcpp=no - ;; - *) - vips_needs_stdcpp=yes - ;; -esac -AC_MSG_RESULT([$vips_needs_stdcpp]) - AC_MSG_CHECKING([for native Win32]) case "$host" in *-*-mingw*) diff --git a/libvips/colour/scRGB2BW.c b/libvips/colour/scRGB2BW.c index d378ca06..f838e74d 100644 --- a/libvips/colour/scRGB2BW.c +++ b/libvips/colour/scRGB2BW.c @@ -113,7 +113,7 @@ vips_scRGB2BW_line_16( unsigned short * restrict q, float * restrict p, q += 1; for( j = 0; j < extra_bands; j++ ) - q[j] = VIPS_FCLIP( 0, p[j] * 256.0, USHRT_MAX ); + q[j] = VIPS_CLIP( 0, (int) (p[j] * 256.0), USHRT_MAX ); p += extra_bands; q += extra_bands; } diff --git a/libvips/colour/scRGB2sRGB.c b/libvips/colour/scRGB2sRGB.c index 636e77a1..79cfacb6 100644 --- a/libvips/colour/scRGB2sRGB.c +++ b/libvips/colour/scRGB2sRGB.c @@ -140,7 +140,7 @@ vips_scRGB2sRGB_line_16( unsigned short * restrict q, float * restrict p, q += 3; for( j = 0; j < extra_bands; j++ ) - q[j] = VIPS_FCLIP( 0, p[j] * 256.0, USHRT_MAX ); + q[j] = VIPS_CLIP( 0, (int) (p[j] * 256.0), USHRT_MAX ); p += extra_bands; q += extra_bands; } diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index 08d8e7c3..a646f365 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -212,6 +212,7 @@ typedef struct { /* Private stuff during read. */ + ReadJpeg *jpeg; VipsSource *source; unsigned char buf[SOURCE_BUFFER_SIZE]; @@ -248,7 +249,11 @@ source_fill_input_buffer( j_decompress_ptr cinfo ) src->pub.bytes_in_buffer = read; } else { - WARNMS( cinfo, JWRN_JPEG_EOF ); + if( src->jpeg->fail ) + ERREXIT( cinfo, JERR_INPUT_EOF ); + else + WARNMS( cinfo, JWRN_JPEG_EOF ); + src->pub.next_input_byte = eoi_buffer; src->pub.bytes_in_buffer = 2; } @@ -294,6 +299,7 @@ readjpeg_open_input( ReadJpeg *jpeg ) sizeof( Source ) ); src = (Source *) cinfo->src; + src->jpeg = jpeg; src->source = jpeg->source; src->pub.init_source = source_init_source; src->pub.fill_input_buffer = source_fill_input_buffer; diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index cad03afb..df3342fb 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -161,6 +161,8 @@ user_warning_function( png_structp png_ptr, png_const_charp warning_msg ) g_warning( "%s", warning_msg ); } +#ifndef HAVE_SPNG + #define INPUT_BUFFER_SIZE (4096) /* What we track during a PNG read. @@ -763,6 +765,8 @@ vips__png_isinterlaced_source( VipsSource *source ) return( interlace_type != PNG_INTERLACE_NONE ); } +#endif /*!defined(HAVE_SPNG)*/ + const char *vips__png_suffs[] = { ".png", NULL }; /* What we track during a PNG write.