Skip to content

Commit dc19f7b

Browse files
author
HeroicKatora
authored
Merge pull request #260 from micahsnyder/issue-250-arithmetic-overflow
Mitigate panic due to arithmetic overflow in lossless module
2 parents b3165d6 + 3179243 commit dc19f7b

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)