Commit 2e136a7
committed
Re-fix buf img mode decompr err w/short prog JPEGs
This commit reverts 4dbc293 and
9f8f683 (the previous two commits) and
fixes #613 the correct way. The crux of the issue wasn't the size of
the whole_image virtual array but rather that, since last_iMCU_row is
unsigned, (last_iMCU_row - 1) wrapped around to 0xFFFFFFFF when
last_iMCU_row was 0. This caused the interblock smoothing algorithm
introduced in 6d91e95 to erroneously
try to access the next two iMCU rows, neither of which existed. The
first attempt at a fix (4dbc293)
exposed a NULL dereference, detected by OSS-Fuzz, that occurred when
attempting to decompress a specially-crafted malformed JPEG image to a
YUV buffer using tjDecompressToYUV*() with 1/4 IDCT scaling.
Fixes #613 (again)
Also fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=498981 parent 9f8f683 commit 2e136a7
2 files changed
Lines changed: 10 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | | - | |
| 563 | + | |
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | 838 | | |
842 | 839 | | |
843 | 840 | | |
844 | | - | |
| 841 | + | |
845 | 842 | | |
846 | | - | |
847 | | - | |
848 | 843 | | |
849 | 844 | | |
850 | 845 | | |
851 | 846 | | |
852 | | - | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
853 | 850 | | |
854 | 851 | | |
855 | 852 | | |
| |||
0 commit comments