Validate PBM max pixel value
Merged
JI
5mo ago+18+18+01234567890123456789-0-0-0123456789
Prerequisites
- I have written a descriptive pull-request title
- I have verified that there are no overlapping pull-requests open
- I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules :cop:.
- I have provided test coverage for my change (where applicable)
Description
Fixes #3130
This pull request adds stricter validation for the PBM image decoder to ensure that only valid max pixel values are accepted, and introduces corresponding tests to verify this behavior.
Decoder validation improvement:
- Added a check in
PbmDecoderCore.csto throw anInvalidImageContentExceptionifmaxPixelValueis less than or equal to 0 or greater than or equal to 65536, preventing invalid PBM images from being processed.
Test coverage:
- Added a new parameterized test in
PbmDecoderTests.csto verify that decoding PBM images with a max pixel value of 0 for all supported magic numbers throws anInvalidImageContentException.