The RGB555 PACKBITSRGN case tries to read a palette, if such palette is actually stored then it accesses a null pointer. All 16bit samples i could find use DIRECTBITSRGN. Fixes: 2065/clusterfuzz-testcase-minimized-6298930457346048
Unified · Split
| @@ -58,6 +58,8 @@ static int parse_palette(AVCodecContext *avctx, GetByteContext *gbc, · 57 unmodified lines | ||
| 58 | 58 | bytestream2_skip(gbc, 6); |
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | + if (avctx->pix_fmt != AV_PIX_FMT_PAL8) | |
| 62 | + return AVERROR_INVALIDDATA; | |
| 61 | 63 | r = bytestream2_get_byte(gbc); |
| 62 | 64 | bytestream2_skip(gbc, 1); |
| 63 | 65 | g = bytestream2_get_byte(gbc); |
| @@ -378,7 +380,9 @@ static int decode_frame(AVCodecContext *avctx, · 314 unmodified lines | ||
| 378 | 380 | if ((ret = ff_get_buffer(avctx, p, 0)) < 0) |
| 379 | 381 | return ret; |
| 380 | 382 | |
| 381 | − parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors); | |
| 383 | + ret = parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors); | |
| 384 | + if (ret < 0) | |
| 385 | + return ret; | |
| 382 | 386 | p->palette_has_changed = 1; |
| 383 | 387 | |
| 384 | 388 | /* jump to image data */ |