From e9ce212b62c36face4d55a746aa94234173fc73a Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 2 Sep 2014 09:37:08 +0100 Subject: [PATCH 1/5] 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. --- ChangeLog | 1 + libvips/foreign/jpeg2vips.c | 6 +++++- libvips/foreign/vipspng.c | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) 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 ); From 501e900be5e2286988244574d0796475e0e65799 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 2 Sep 2014 13:40:37 +0100 Subject: [PATCH 2/5] tiny polish --- libvips/conversion/sequential.c | 2 +- tools/vipsthumbnail.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libvips/conversion/sequential.c b/libvips/conversion/sequential.c index f9e392c1..5ab04cc0 100644 --- a/libvips/conversion/sequential.c +++ b/libvips/conversion/sequential.c @@ -71,7 +71,7 @@ #include "pconversion.h" /* Stall threads that run ahead for up to this long, in seconds. Normally they - * will be woken up long before this, once their data is ready. The timeout is + * will be woken once their data is ready and long before this. The timeout is * just to prevent a total crash in the case of accidental deadlock. * * This has to be a long time: if we're trying to use all cores on a busy diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index cb250fc2..a946bc0e 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -490,7 +490,7 @@ thumbnail_shrink( VipsObject *process, VipsImage *in, if( vips_tilecache( in, &t[4], "tile_width", in->Xsize, "tile_height", 10, - "max_tiles", (nlines * 2) / 10, + "max_tiles", 1 + (nlines * 2) / 10, "access", VIPS_ACCESS_SEQUENTIAL, "threaded", TRUE, NULL ) ) From 5ab3009ce2b65a2f745c87706aa05c1a9f800292 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 7 Sep 2014 10:21:01 +0100 Subject: [PATCH 3/5] add thread_shutdown() to python see https://github.com/jcupitt/libvips/issues/170 --- ChangeLog | 1 + libvipsCC/VImage.cc | 5 +++++ libvipsCC/include/vips/VImage.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3bac2216..8c4cab6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ - 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 +- add thread_shutdown() to C++ (and thereby to python) 12/8/14 started 7.40.6 - more doc fixes diff --git a/libvipsCC/VImage.cc b/libvipsCC/VImage.cc index 5709762d..f229d1d9 100644 --- a/libvipsCC/VImage.cc +++ b/libvipsCC/VImage.cc @@ -64,6 +64,11 @@ void shutdown() vips_shutdown(); } +void thread_shutdown() +{ + vips_thread_shutdown(); +} + void VImage::refblock::debug_print() { std::list::iterator i; diff --git a/libvipsCC/include/vips/VImage.h b/libvipsCC/include/vips/VImage.h index c37deac8..cead3969 100644 --- a/libvipsCC/include/vips/VImage.h +++ b/libvipsCC/include/vips/VImage.h @@ -63,6 +63,7 @@ VIPS_NAMESPACE_START /* vips_init() and vips_shutdown as namespaced C++ functions. */ bool init( const char *argv0 = "nothing" ); +void thread_shutdown( void ); void shutdown( void ); /* A VIPS callback, our name for im_callback_fn. @@ -451,6 +452,8 @@ VIPS_NAMESPACE_END // Other VIPS protos we need extern "C" { extern int im_init_world( const char *argv0 ); +extern int im_init_world( const char *argv0 ); +extern void vips_thread_shutdown( void ); extern void im__print_all(); extern void im_col_Lab2XYZ( float, float, float, From a620170362c6de62c0afba6772998e581e063989 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 8 Sep 2014 18:56:51 +0100 Subject: [PATCH 4/5] Prevent empty else block in configure Enables libvips to compile on RHEL/Centos 6 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6e02fca9..551c0ad8 100644 --- a/configure.ac +++ b/configure.ac @@ -365,7 +365,7 @@ PACKAGES_USED="$PACKAGES_USED glib-2.0 libxml-2.0 gmodule-2.0 gobject-2.0" # after 2.28 we have a monotonic timer PKG_CHECK_MODULES(MONOTONIC, glib-2.0 >= 2.28,[ AC_DEFINE(HAVE_MONOTONIC_TIME,1,[define if your glib has g_get_monotonic_time().]) - ],[ + ],[: ] ) @@ -386,7 +386,7 @@ PKG_CHECK_MODULES(THREADS, glib-2.0 >= 2.32,[ # with 2.36 and after the type system inits itself PKG_CHECK_MODULES(TYPE_INIT, glib-2.0 < 2.36,[ AC_DEFINE(NEED_TYPE_INIT,1,[define if your glib needs g_type_init().]) - ],[ + ],[: ] ) From a8becfc9d4c473f93e7f2d1ee4b601b7b2ac7f1f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 8 Sep 2014 19:47:01 +0100 Subject: [PATCH 5/5] bump version to 7.40.8 --- ChangeLog | 3 +++ configure.ac | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c4cab6f..d1eb608c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +8/9/14 started 7.40.8 +- fix configure on rhel6 [Lovell] + 21/8/14 started 7.40.7 - width and height were swapped in matlab load - set interpretation more carefully on matlab load diff --git a/configure.ac b/configure.ac index 551c0ad8..e1737307 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [7.40.7], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [7.40.8], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [7]) m4_define([vips_minor_version], [40]) -m4_define([vips_micro_version], [7]) +m4_define([vips_micro_version], [8]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version])