make out of order read a fatal error

For png and jpg, out of order must always be a fatal error, since you
can't read from a specific y position.

This was a g_assert() before which meant that this test was missing from
production builds. It's now always a fatal error.
This commit is contained in:
John Cupitt 2014-09-02 09:37:08 +01:00
parent 70b35f5ec5
commit e9ce212b62
3 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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().
*/

View File

@ -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 );