Prevents using GetBitContexts with data from previous calls. Fixes access to freed memory.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:[email protected] --- libavcodec/h264.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index d43b11e..adb0dbe 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4750,6 +4750,13 @@ again: } break; case NAL_DPA: + if (h->avctx->flags & CODEC_FLAG2_CHUNKS) { + av_log(h->avctx, AV_LOG_ERROR, + "Decoding in chunks is not supported for " + "partitioned slices.\n"); + return AVERROR(ENOSYS); + } + init_get_bits(&hx->gb, ptr, bit_length); hx->intra_gb_ptr = hx->inter_gb_ptr = NULL; @@ -4899,6 +4906,9 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, int ret; h->flags = avctx->flags; + /* reset data partitioning here, to ensure GetBitContexts from previous + * packets do not get used. */ + h->data_partitioning = 0; /* end of stream, output what is still in the buffers */ out: -- 1.7.10.4 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
