diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cb988981..6a3a7aae 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: @@ -39,7 +39,7 @@ jobs: FEATURES: ${{ matrix.features }} cross_compile_aarch64: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: @@ -71,7 +71,7 @@ jobs: FEATURES: ${{ matrix.features }} CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc cross_compile_wasm: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Install node run: | diff --git a/src/parser.rs b/src/parser.rs index 5b4dffe1..b17e7e9a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -405,6 +405,12 @@ pub fn parse_sos(reader: &mut R, frame: &FrameInfo) -> Result let predictor_selection; let point_transform = successive_approximation_low; + if point_transform >= frame.precision { + return Err(Error::Format( + "invalid point transform, must be less than the frame precision".to_owned(), + )); + } + if frame.coding_process == CodingProcess::DctProgressive { predictor_selection = Predictor::NoPrediction; if spectral_selection_end > 63 || spectral_selection_start > spectral_selection_end || diff --git a/tests/crashtest/images/invalid-prediction-shift.jpg b/tests/crashtest/images/invalid-prediction-shift.jpg new file mode 100644 index 00000000..386f63eb Binary files /dev/null and b/tests/crashtest/images/invalid-prediction-shift.jpg differ