From 7d35184ced07276477d78aacbf83e587e5c1169c Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 14 Aug 2024 14:13:49 +0200 Subject: [PATCH] gpujpeg_reader: print if actual segments doesn't match expected number to check broken JPEGs --- src/gpujpeg_reader.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gpujpeg_reader.c b/src/gpujpeg_reader.c index d6763b71..e03485c3 100644 --- a/src/gpujpeg_reader.c +++ b/src/gpujpeg_reader.c @@ -1481,6 +1481,11 @@ gpujpeg_reader_read_image(struct gpujpeg_decoder* decoder, uint8_t* image, size_ } } + if ( reader.segment_count != decoder->coder.segment_count ) { + fprintf(stderr, "[GPUJPEG] [Warning] %d segments read, expected %d. Broken JPEG?\n", + reader.segment_count, decoder->coder.segment_count); + } + // Check EOI marker if ( eoi_presented == 0 ) { fprintf(stderr, "[GPUJPEG] [Error] JPEG data should end with EOI marker!\n");