-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try harder to find the next valid JPEG marker when decoding Scan data (issue 8182, issue 8189) #8190
Conversation
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/f457c2d562dd976/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/f457c2d562dd976/output.txt Total script time: 29.32 mins
|
/botio-windows test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/5facc8340bbd646/output.txt |
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/5facc8340bbd646/output.txt Total script time: 22.83 mins
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with comments addressed.
src/core/jpg.js
Outdated
} | ||
} | ||
return { | ||
invalid: currentMarker.toString('16'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fix toString arg type .toString(16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed now.
src/core/jpg.js
Outdated
var newMarker = peekUint16(newPos); | ||
while (!(newMarker >= 0xFFC0 && newMarker <= 0xFFFE)) { | ||
newMarker = peekUint16(++newPos); | ||
if (newPos >= maxPos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increment newPos and move this if before peekUint16() call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it's done.
@@ -594,6 +605,39 @@ var JpegImage = (function JpegImageClosure() { | |||
return a <= 0 ? 0 : a >= 255 ? 255 : a; | |||
} | |||
|
|||
function findNextFileMarker(data, currentPos, startPos) { | |||
function peekUint16(pos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use readUint16 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As agreed on IRC, since there already is such a function (see
Line 600 in cd5acf5
function readUint16() { |
… (issue 8182, issue 8189) Tentatively fixes 8182 and fixes 8189.
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/c7c80185fe3ef0f/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/e393cc08072fb15/output.txt |
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/e393cc08072fb15/output.txt Total script time: 23.11 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/c7c80185fe3ef0f/output.txt Total script time: 29.05 mins
|
/botio makeref |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/2db836b3910d485/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/8532b7c299aaaa8/output.txt |
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/8532b7c299aaaa8/output.txt Total script time: 22.61 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/2db836b3910d485/output.txt Total script time: 28.52 mins
|
Try harder to find the next valid JPEG marker when decoding Scan data (issue 8182, issue 8189)
Tentatively fixes #8182 and fixes #8189.