Commit dd70fe9
Bound decoded GIF frame storage
Summary:
GIF logical-screen dimensions are expanded into full-canvas RGBA32 frames. A tiny input declaring a 24,930 by 38,911 screen therefore drives roughly 3.9 GiB of initialization before any useful decode result.
Reject a single canvas or retained frame set above the existing 1 GiB decoded-frame budget, before allocating or copying it. The division-based checks add O(1) work; accepted decode complexity remains O(frame count * canvas pixels), with aggregate output storage bounded to 1 GiB. Add a synthetic regression with the exact oversized dimensions and a valid 1x1 control.
Differential Revision: D114062863
fbshipit-source-id: faf9ebdeb9a0c6ec39694047eebda071adbb12241 parent 041112a commit dd70fe9
2 files changed
Lines changed: 42 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
178 | 195 | | |
179 | 196 | | |
180 | 197 | | |
| |||
192 | 209 | | |
193 | 210 | | |
194 | 211 | | |
195 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
196 | 216 | | |
197 | | - | |
198 | | - | |
| 217 | + | |
199 | 218 | | |
200 | | - | |
| 219 | + | |
201 | 220 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 221 | | |
208 | 222 | | |
209 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
485 | 504 | | |
486 | 505 | | |
487 | 506 | | |
| |||
0 commit comments