Commit 76b491d
[SECURITY] Avoid free'ing a wild pointer on PNG decode
In certain cases, a PNG could be fed into `load_png` which would act as
a DoS vector.
I fixed this in two ways:
* making sure `rows` is instantiated to NULL and checking if it's NULL
before freeing it;
* the minimum length of PNG data is known to be 67 bytes. So, if it's
less, we know we can error out.
Resolves CVE-2020-11721.
Closes saitoha/libpixel#134.
Closes #9.1 parent 3885ab8 commit 76b491d
1 file changed
+14
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
| 320 | + | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | 339 | | |
341 | 340 | | |
342 | 341 | | |
| |||
348 | 347 | | |
349 | 348 | | |
350 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
351 | 358 | | |
352 | 359 | | |
353 | 360 | | |
| |||
357 | 364 | | |
358 | 365 | | |
359 | 366 | | |
| 367 | + | |
360 | 368 | | |
361 | 369 | | |
362 | 370 | | |
| |||
647 | 655 | | |
648 | 656 | | |
649 | 657 | | |
650 | | - | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
651 | 662 | | |
652 | 663 | | |
653 | 664 | | |
| |||
0 commit comments