Skip to content

Commit

Permalink
Merge pull request #1757 from fintelia/bug-1750
Browse files Browse the repository at this point in the history
Fix arithmetic overflow in TIFF error reporting
  • Loading branch information
fintelia committed Jul 10, 2022
2 parents 04052e6 + 3f81a8d commit 90e8c11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
env:
FEATURES: ${{ matrix.features }}
- name: test
if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' || matrix.rust == 'nightly' }}
run: >
cargo test -v --no-default-features --features "$FEATURES" &&
cargo doc -v --no-default-features --features "$FEATURES"
Expand Down
6 changes: 3 additions & 3 deletions src/codecs/tiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ where
tiff::ColorType::Palette(n) | tiff::ColorType::Gray(n) => {
return Err(err_unknown_color_type(n))
}
tiff::ColorType::GrayA(n) => return Err(err_unknown_color_type(n * 2)),
tiff::ColorType::RGB(n) => return Err(err_unknown_color_type(n * 3)),
tiff::ColorType::GrayA(n) => return Err(err_unknown_color_type(n.saturating_mul(2))),
tiff::ColorType::RGB(n) => return Err(err_unknown_color_type(n.saturating_mul(3))),
tiff::ColorType::RGBA(n) | tiff::ColorType::CMYK(n) => {
return Err(err_unknown_color_type(n * 4))
return Err(err_unknown_color_type(n.saturating_mul(4)))
}
};

Expand Down

0 comments on commit 90e8c11

Please sign in to comment.