Browse Source

avcodec/h264: Check mode before considering mixed mode intra prediction

Fixes out of array read
Fixes: asan_heap-oob_e476fc_2_asan_heap-oob_1333ec6_61_CAMACI3_Sony_C.jsv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9734a7a1de)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.3.5
Michael Niedermayer 11 years ago
parent
commit
279003eb9e
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      libavcodec/h264.c

+ 6
- 6
libavcodec/h264.c View File

@@ -215,18 +215,18 @@ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma)


if ((h->left_samples_available & 0x8080) != 0x8080) { if ((h->left_samples_available & 0x8080) != 0x8080) {
mode = left[mode]; mode = left[mode];
if (is_chroma && (h->left_samples_available & 0x8080)) {
// mad cow disease mode, aka MBAFF + constrained_intra_pred
mode = ALZHEIMER_DC_L0T_PRED8x8 +
(!(h->left_samples_available & 0x8000)) +
2 * (mode == DC_128_PRED8x8);
}
if (mode < 0) { if (mode < 0) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
"left block unavailable for requested intra mode at %d %d\n", "left block unavailable for requested intra mode at %d %d\n",
h->mb_x, h->mb_y); h->mb_x, h->mb_y);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (is_chroma && (h->left_samples_available & 0x8080)) {
// mad cow disease mode, aka MBAFF + constrained_intra_pred
mode = ALZHEIMER_DC_L0T_PRED8x8 +
(!(h->left_samples_available & 0x8000)) +
2 * (mode == DC_128_PRED8x8);
}
} }


return mode; return mode;


Loading…
Cancel
Save