diff --git a/ChangeLog b/ChangeLog index a065aaa8..3bac2216 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ - fix memleak in VipsArray [Lovell] - fix memleak in webp load from buffer [Lovell] - fix memleak in png save to buffer [Lovell] +- make out of order read in png and jpg a fatal error 12/8/14 started 7.40.6 - more doc fixes diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index 2483de3c..666ec61c 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -916,7 +916,11 @@ read_jpeg_generate( VipsRegion *or, /* And check that y_pos is correct. It should be, since we are inside * a vips_sequential(). */ - g_assert( r->top == jpeg->y_pos ); + if( r->top != jpeg->y_pos ) { + vips_error( "VipsJpeg", + _( "out of order read at line %d" ), jpeg->y_pos ); + return( -1 ); + } /* Here for longjmp() from vips__new_error_exit(). */ diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index c8fefc7c..f89bb58d 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -483,7 +483,11 @@ png2vips_generate( VipsRegion *or, /* And check that y_pos is correct. It should be, since we are inside * a vips_sequential(). */ - g_assert( r->top == read->y_pos ); + if( r->top != read->y_pos ) { + vips_error( "vipspng", + _( "out of order read at line %d" ), read->y_pos ); + return( -1 ); + } for( y = 0; y < r->height; y++ ) { png_bytep q = (png_bytep) VIPS_REGION_ADDR( or, 0, r->top + y );