Skip to content

Commit 666d420

Browse files
authored
Merge pull request #565 from treeform/fix-progressive-ac-refinement-jpeg
Fix progressive AC refinement JPEG decoding
2 parents 5eda494 + 7d222c7 commit 666d420

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/pixie/fileformats/jpeg.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ proc decodeSOS(state: var DecoderState) =
508508
if state.progressive:
509509
if state.spectralStart > 63 or state.spectralEnd > 63:
510510
failInvalid()
511-
if state.spectralEnd > state.spectralEnd:
511+
if state.spectralStart > state.spectralEnd:
512512
failInvalid()
513513
if state.successiveApproxHigh > 13 or state.successiveApproxLow > 13:
514514
failInvalid()
@@ -715,7 +715,7 @@ proc decodeProgressiveContinuationBlock(
715715

716716
if state.eobRun != 0:
717717
dec state.eobRun
718-
for k in state.spectralStart ..< state.spectralEnd:
718+
for k in state.spectralStart .. state.spectralEnd:
719719
let zig = deZigZag[k]
720720
if data[zig] != 0:
721721
if state.readBit() != 0:
246 KB
Loading

tests/jpegsuite.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const jpegSuiteFiles* = [
3131
"tests/fileformats/jpeg/masters/exif_overrun.jpg",
3232
"tests/fileformats/jpeg/masters/grayscale_test.jpg",
3333
"tests/fileformats/jpeg/masters/progressive.jpg",
34+
"tests/fileformats/jpeg/masters/chair_normal.jpg",
3435

3536
"tests/fileformats/jpeg/masters/testimg.jpg",
3637
"tests/fileformats/jpeg/masters/testimgp.jpg",

0 commit comments

Comments
 (0)