diff --git a/src/pixie/fileformats/jpeg.nim b/src/pixie/fileformats/jpeg.nim index fb782e48..0d5cbd01 100644 --- a/src/pixie/fileformats/jpeg.nim +++ b/src/pixie/fileformats/jpeg.nim @@ -508,7 +508,7 @@ proc decodeSOS(state: var DecoderState) = if state.progressive: if state.spectralStart > 63 or state.spectralEnd > 63: failInvalid() - if state.spectralEnd > state.spectralEnd: + if state.spectralStart > state.spectralEnd: failInvalid() if state.successiveApproxHigh > 13 or state.successiveApproxLow > 13: failInvalid() @@ -715,7 +715,7 @@ proc decodeProgressiveContinuationBlock( if state.eobRun != 0: dec state.eobRun - for k in state.spectralStart ..< state.spectralEnd: + for k in state.spectralStart .. state.spectralEnd: let zig = deZigZag[k] if data[zig] != 0: if state.readBit() != 0: diff --git a/tests/fileformats/jpeg/masters/chair_normal.jpg b/tests/fileformats/jpeg/masters/chair_normal.jpg new file mode 100644 index 00000000..a2d96be3 Binary files /dev/null and b/tests/fileformats/jpeg/masters/chair_normal.jpg differ diff --git a/tests/jpegsuite.nim b/tests/jpegsuite.nim index 51d04e91..ead7a906 100644 --- a/tests/jpegsuite.nim +++ b/tests/jpegsuite.nim @@ -31,6 +31,7 @@ const jpegSuiteFiles* = [ "tests/fileformats/jpeg/masters/exif_overrun.jpg", "tests/fileformats/jpeg/masters/grayscale_test.jpg", "tests/fileformats/jpeg/masters/progressive.jpg", + "tests/fileformats/jpeg/masters/chair_normal.jpg", "tests/fileformats/jpeg/masters/testimg.jpg", "tests/fileformats/jpeg/masters/testimgp.jpg",