Commit 1f8bd19
committed
gainmap: check avifImageCreateEmpty() result
avifRGBImageApplyGainMap() calls avifImageCreateEmpty() to back the
rescaledGainMap when the gain map image's dimensions differ from the
base image's, but does not check the return value. The next line
calls avifImageSetViewRect(rescaledGainMap, ...), which dereferences
the destination image via avifImageFreePlanes() before any rect
validation, so a NULL return from avifImageCreateEmpty() crashes the
caller under memory pressure.
This is the same pattern fixed for avifImageCopy() in PR AOMediaCodec#3201.
Bail to the existing cleanup label with AVIF_RESULT_OUT_OF_MEMORY
when the allocation fails.1 parent 3c66271 commit 1f8bd19
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
190 | 194 | | |
191 | 195 | | |
192 | 196 | | |
| |||
0 commit comments