Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuli Khodorkovskiy <ykhodo@gmail.com>2016-07-29 18:00:44 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-07 20:16:24 +0300
commitf0adb99d068e659178c00271a46cd469dfc01a6e (patch)
tree8411aff9ae05d21dc8de5471c89ed8b0bf543687 /libavcodec/qsvdec.c
parentbbec14de3126dbc4e1ec2b32ed714dab173386aa (diff)
avcodec/qsvdec: Fix null dereferences in the qsv decoder
This patch fixes the h264_qsv decoder issues mentioned in https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2962. The patch may be tested by specifying h264_qsv as the decoder to ffplay for an h264 encoded file. ffplay -vcodec h264_qsv foo.mts Signed-off-by: Yuli Khodorkovskiy <ykhodo@gmail.com> Push requested-by: Ivan Uskov Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/qsvdec.c')
-rw-r--r--libavcodec/qsvdec.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 9125700e8a..98585e3f78 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -555,16 +555,18 @@ void ff_qsv_decode_reset(AVCodecContext *avctx, QSVContext *q)
}
/* Reset output surfaces */
- av_fifo_reset(q->async_fifo);
+ if (q->async_fifo)
+ av_fifo_reset(q->async_fifo);
/* Reset input packets fifo */
- while (av_fifo_size(q->pkt_fifo)) {
+ while (q->pkt_fifo && av_fifo_size(q->pkt_fifo)) {
av_fifo_generic_read(q->pkt_fifo, &pkt, sizeof(pkt), NULL);
av_packet_unref(&pkt);
}
/* Reset input bitstream fifo */
- av_fifo_reset(q->input_fifo);
+ if (q->input_fifo)
+ av_fifo_reset(q->input_fifo);
}
int ff_qsv_decode_close(QSVContext *q)