Skip to content

Commit

Permalink
gpujpeg_reader: print if actual segments doesn't match expected number
Browse files Browse the repository at this point in the history
to check broken JPEGs
  • Loading branch information
MartinPulec committed Aug 14, 2024
1 parent 4f5791e commit 7d35184
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gpujpeg_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 7d35184

Please sign in to comment.