Revert "improve fail on too many warings"

This reverts commit ae7e5e7a54.
This commit is contained in:
John Cupitt 2022-04-05 08:34:20 +01:00
parent ae7e5e7a54
commit 1aebd95387
2 changed files with 6 additions and 19 deletions

View File

@ -494,17 +494,6 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
*/ */
jpeg->eman.pub.trace_level = 3; jpeg->eman.pub.trace_level = 3;
/* Here for longjmp() from vips__new_error_exit() during
* jpeg_read_header(),
*/
if( setjmp( jpeg->eman.jmp ) ) {
#ifdef DEBUG
printf( "read_jpeg_header: longjmp() exit\n" );
#endif /*DEBUG*/
return( -1 );
}
/* Read JPEG header. libjpeg will set out_color_space sanely for us /* Read JPEG header. libjpeg will set out_color_space sanely for us
* for YUV YCCK etc. * for YUV YCCK etc.
*/ */

View File

@ -165,18 +165,16 @@
void void
vips__new_output_message( j_common_ptr cinfo ) vips__new_output_message( j_common_ptr cinfo )
{ {
ErrorManager *eman = (ErrorManager *) cinfo->err;
/* Some DoS attacks use jpg files with thousands of warnings. Try to /* Some DoS attacks use jpg files with thousands of warnings. Try to
* limit the effect these have. * limit the effect these have.
*/ */
if( cinfo->err->num_warnings >= 100 ) { if( cinfo->err->num_warnings >= 20 ) {
vips_error( "VipsJpeg", "%s", _( "too many warnings" ) ); if( cinfo->err->num_warnings == 20 ) {
vips_error( "VipsJpeg",
"%s", _( "too many warnings" ) );
}
/* Bail out of jpeg load (ugh!). We have to hope our caller jpeg_abort( cinfo );
* has set this up.
*/
longjmp( eman->jmp, 1 );
} }
else { else {
char buffer[JMSG_LENGTH_MAX]; char buffer[JMSG_LENGTH_MAX];