Skip to content

jpegparse: fix incorrect reading of transform in app14 marker

HuQian requested to merge HuQian/gstreamer:dev-jpegparseycck into main

"adobe" in app14 marker seem not a null-terminted string. so, when we use gst_byte_reader_get_string_utf8, more bytes will be read until null. and "gst_byte_reader_get_uint8 (&reader, &transform)" will almost fail to read transform

this is my test file, and i find jpegparse consider it is CMYK, but YCCK by libjpeg-turbo

320x240_120ppi_square_baseline_q0

image

and from source code, ffmpeg/libjpeg-turbo seem do not consider "Adobe" a null-terminated string.

ffmpeg parsing app14 flow:

https://github.com/FFmpeg/FFmpeg/blob/654bd47716c4f36719fb0f3f7fd8386d5ed0b916/libavcodec/mjpegdec.c#L1933

https://github.com/FFmpeg/FFmpeg/commit/0f31d401c35c6d39462c2b3e2aa7b573db0ccfde

libjpeg-turbo emit jpeg app14:

https://github.com/libjpeg-turbo/libjpeg-turbo/blob/b4336c3afb575d4390365a1be0f7dbabb0cc5161/jcmarker.c#L390

but this PDF consider it is null-terminted

https://www.itu.int/rec/T-REC-T.872-201206-I/en

Edited by HuQian

Merge request reports

Loading