fix getJpegInfo to skip DHT marker#3854
Conversation
|
So, what needs to be done to get those pending checks to actually run? |
|
Let me have a look into this |
There was a problem hiding this comment.
Pull Request Overview
This PR updates getJpegInfo to properly skip the DHT marker (0xC4) since it is not a Start Of Frame marker.
- Refines comment block to label SOF markers and note skipping of DHT
- Removes
0xc4from themarkersarray - Adjusts the list of subsequent SOF markers
Comments suppressed due to low confidence (3)
src/modules/jpeg_support.js:29
- [nitpick] Consider renaming
markerstosofMarkersorSOF_MARKERSto more clearly convey that this array contains Start Of Frame markers.
var markers = [0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7];
src/modules/jpeg_support.js:24
- Add a unit test that includes a JPEG with a DHT segment to verify that
getJpegInfocorrectly skips the DHT marker and still extracts width and height.
* 0xc4 Define Huffman Tables (DHT) - skip
src/modules/jpeg_support.js:29
- Use
constinstead ofvarfor themarkersarray since it is not reassigned.
var markers = [0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7];
|
Speaking on behalf of my colleague, rnigro-rwb, who made this P.R.; is this waiting on us to do anything before it'll be considered? |
|
The workflow jobs are not running. Is there a way to trigger them? |
|
Per this comment: #3376 (comment) It seems this also fixes issue #3376. Unfortunately, there is no way to be certain as the original images are no longer available |
|
Hi @MrRio, since you took a look at this PR and I need the fix, is there any open task one could help with concerning this change? |
|
up |
Fixes #3318.
getJpegInfonow skips the DHT marker (0xc4) because that marker is not a SOF (start of frame) marker and therefore the segment to follow does not have the size information.To add to insight to this fix, the original getJpegInfo sites http://www.64lines.com/jpeg-width-height which itself sites a reference for header info: JPEG Header Information
As you can see here, Define Huffman table marker (FFC4), 0xC4 is a marker for the Huffman table.
My fix skips 0xC4 and adjusts the remaining Start of frame (SOFn) markers to be correct.