Skip to content

Commit 3179243

Browse files
committed
Mitigate panic due to arithmetic overflow in lossless module
Fixes #250
1 parent beb46c0 commit 3179243

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/decoder/lossless.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ fn predict(
198198
) -> i32 {
199199
if (ix == 0 && iy == 0) || restart {
200200
// start of first line or restart
201-
1 << (input_precision - point_transform - 1)
201+
if input_precision > 1 + point_transform {
202+
1 << (input_precision - point_transform - 1)
203+
} else {
204+
0
205+
}
202206
} else if iy == 0 {
203207
// rest of first line
204208
ra

0 commit comments

Comments
 (0)