From 403cbecdeaf3cd76c845205c52818e4c6a64c15e Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Sat, 25 Nov 2006 00:31:25 +0100 Subject: [PATCH] fixed segfaulting libjpeg warnings when decoding partially wrong images... now we reject such images, but it can be easily changed in ifdef --- images/io-libjpeg.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/images/io-libjpeg.c b/images/io-libjpeg.c index 03952519..144e0b0e 100644 --- a/images/io-libjpeg.c +++ b/images/io-libjpeg.c @@ -75,8 +75,17 @@ libjpeg_emit_message(j_common_ptr cinfo UNUSED, int msg_level UNUSED) cinfo->err->format_message(cinfo, buf); DBG("libjpeg_emit_message(): [%d] %s", msg_level, buf); #endif +#if 1 + // Terminate on warning? if (unlikely(msg_level == -1)) - longjmp(((struct libjpeg_err *)(cinfo)->err)->setjmp_buf, 1); + { + struct libjpeg_err *e = (struct libjpeg_err *)cinfo->err; + byte buf[JMSG_LENGTH_MAX]; + cinfo->err->format_message(cinfo, buf); + IMAGE_ERROR(e->io->context, 0, "libjpeg: %s", buf); + longjmp(e->setjmp_buf, 1); + } +#endif } static inline uns -- 2.39.2