From 26755a8c6f6d3f548b941c9848d5e16fb19b1493 Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 23 Feb 2018 00:03:15 -0300 Subject: [PATCH] avformat/hvcc: zero initialize the nal buffers past the last written byte Prevents use of uninitialized values. Fixes ticket #7038. Reviewed-by: Michael Niedermayer Signed-off-by: James Almer (cherry picked from commit 9482ec1b203e4cf51d7f60c85d261cc13f9a9d2f) --- libavformat/hevc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/hevc.c b/libavformat/hevc.c index 7c294ef8a2..4c7ffc3312 100644 --- a/libavformat/hevc.c +++ b/libavformat/hevc.c @@ -668,6 +668,8 @@ static uint8_t *nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, while (i < src_len) dst[len++] = src[i++]; + memset(dst + len, 0, AV_INPUT_BUFFER_PADDING_SIZE); + *dst_len = len; return dst; }