Commit 8835db0
committed
test/oss-fuzz: address Copilot review on openexr_exrgaps_fuzzer
Six fixes from the Copilot review of #2401:
1. read_u32(): cast each byte to uint32_t before shifting/ORing.
The previous form left-shifted promoted-to-int values, which is
undefined behavior in C++ when the shifted value would set the sign
bit.
2. write_temp(): handle short writes and EINTR. The single write()
call could legally return early or be interrupted, causing valid
inputs to be silently dropped. Loop until the full buffer is
written, retrying on EINTR.
3. Add explicit #include <algorithm> for std::min, which was
previously relying on transitive inclusion. Also add <cerrno>.
4. Mode 0 (test_tiled_random_coords): replace
`if (hdr.find("type") != hdr.end()) continue;` with a check on
the actual type value. MultiPartInputFile auto-synthesizes a
"type" attribute when missing, so the previous check effectively
skipped every part. Mirror the fix in test_deep_tiled to require
hdr.type() == DEEPTILE explicitly. Use Imf::DEEPTILE constants
from ImfPartType.h.
5. Mode 1 (test_tiled_range): clamp the (dx2-dx1+1)*(dy2-dy1+1)
product so a single readTiles() call requests at most
kMaxRangeSide^2 = 64 tiles, down from the prior 32x32 = 1024.
Improves fuzz throughput on valid tiled inputs without losing
coverage of small-range and boundary cases.
6. CMakeLists.txt: replace the duplicated fuzzer list in the
oss_fuzz custom target's DEPENDS with ${OPENEXR_FUZZERS}, so the
list is maintained in one place.
Signed-off-by: Anthony Hurtado <amhurtado@pm.me>1 parent 52a6cec commit 8835db0
2 files changed
Lines changed: 40 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
59 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
60 | 80 | | |
61 | | - | |
| 81 | + | |
62 | 82 | | |
63 | 83 | | |
64 | 84 | | |
| |||
69 | 89 | | |
70 | 90 | | |
71 | 91 | | |
72 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
73 | 96 | | |
74 | 97 | | |
75 | 98 | | |
| |||
85 | 108 | | |
86 | 109 | | |
87 | 110 | | |
88 | | - | |
89 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
90 | 115 | | |
91 | 116 | | |
92 | 117 | | |
| |||
142 | 167 | | |
143 | 168 | | |
144 | 169 | | |
145 | | - | |
146 | 170 | | |
147 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
148 | 174 | | |
149 | 175 | | |
150 | 176 | | |
| |||
176 | 202 | | |
177 | 203 | | |
178 | 204 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
182 | 208 | | |
183 | 209 | | |
184 | 210 | | |
| |||
0 commit comments