Skip to content

Commit 9c138ff

Browse files
committed
Fix panic when prediction calculation is invalid
1 parent e70564b commit 9c138ff

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/parser.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ pub fn parse_sos<R: Read>(reader: &mut R, frame: &FrameInfo) -> Result<ScanInfo>
405405
let predictor_selection;
406406
let point_transform = successive_approximation_low;
407407

408+
if point_transform >= frame.precision {
409+
return Err(Error::Format(
410+
"invalid point transform, must be less than the frame precision".to_owned(),
411+
));
412+
}
413+
408414
if frame.coding_process == CodingProcess::DctProgressive {
409415
predictor_selection = Predictor::NoPrediction;
410416
if spectral_selection_end > 63 || spectral_selection_start > spectral_selection_end ||
3.77 KB
Loading

0 commit comments

Comments
 (0)