Commit 1f83ebc
committed
exif/heic: Avoid overflow when adding box size and checking against file size
We change the order of operations such that the file size check cannot
overflow in the for loop. This prevents infinite loops.
We also add an overflow check at the end of the loop body to prevent the
addition of offset and box.size from overflowing.1 parent 389691a commit 1f83ebc
2 files changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4388 | 4388 | | |
4389 | 4389 | | |
4390 | 4390 | | |
4391 | | - | |
| 4391 | + | |
4392 | 4392 | | |
4393 | 4393 | | |
4394 | 4394 | | |
| |||
4425 | 4425 | | |
4426 | 4426 | | |
4427 | 4427 | | |
| 4428 | + | |
| 4429 | + | |
| 4430 | + | |
4428 | 4431 | | |
4429 | 4432 | | |
4430 | 4433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments