diff --git a/ANNOUNCE b/ANNOUNCE index f8b093ca4..e9e715ccd 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -70,7 +70,7 @@ version 1.4.1beta08 [February 6, 2010] Minor cleanup and updating of dates and copyright year. version 1.4.1beta09 [February 8, 2010] - Fixed incorrect test in new png_push_save_buffer() code. + Reverted to original png_push_save_buffer() code. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index d569d4e7f..474922818 100644 --- a/CHANGES +++ b/CHANGES @@ -2503,7 +2503,7 @@ version 1.4.1beta08 [February 6, 2010] Minor cleanup and updating of dates and copyright year. version 1.4.1beta09 [February 8, 2010] - Fixed incorrect test in new png_push_save_buffer() code. + Reverted to original png_push_save_buffer() code. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngpread.c b/pngpread.c index 999aec43b..5533e48d5 100644 --- a/pngpread.c +++ b/pngpread.c @@ -686,27 +686,19 @@ png_push_save_buffer(png_structp png_ptr) } } } - if (png_ptr->save_buffer_size > - (png_ptr->save_buffer_max - png_ptr->current_buffer_size)) + if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > + png_ptr->save_buffer_max) { png_size_t new_max; png_bytep old_buffer; - if (png_ptr->save_buffer_max == PNG_SIZE_MAX || - (png_ptr->save_buffer_size > PNG_SIZE_MAX - - png_ptr->current_buffer_size)) - png_error(png_ptr, "Overflow of save_buffer"); - if (png_ptr->save_buffer_size > PNG_SIZE_MAX - - (png_ptr->current_buffer_size + - (png_ptr->save_buffer_size >> 3) + 256)) - new_max = PNG_SIZE_MAX; + (png_ptr->current_buffer_size + 256)) + { + png_error(png_ptr, "Potential overflow of save_buffer"); + } - else - new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + - (png_ptr->save_buffer_size >> 3) + 256; - - + new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; old_buffer = png_ptr->save_buffer; png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr, (png_size_t)new_max);