hvcc: zero initialize the nal buffers past the last written byte

Message ID 20180223031744.8412-1-jamrial@gmail.com
State Committed
Commit 502e1a0db9d3d52ca3321d014d9c93610c8f6fff
Headers show
Series
  • hvcc: zero initialize the nal buffers past the last written byte
Related show

Commit Message

James Almer Feb. 23, 2018, 3:17 a.m.
Bug-Id: 1116
Cc: libav-stable@libav.org

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/hevc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Luca Barbato Feb. 23, 2018, 7:14 a.m. | #1
On 23/02/2018 04:17, James Almer wrote:
> Bug-Id: 1116
> Cc: libav-stable@libav.org
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavformat/hevc.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/hevc.c b/libavformat/hevc.c
> index f8bfeebd3..1f8a7bb3c 100644
> --- a/libavformat/hevc.c
> +++ b/libavformat/hevc.c
> @@ -657,6 +657,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;
>   }
> 

Sounds good.

lu

Patch

diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index f8bfeebd3..1f8a7bb3c 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -657,6 +657,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;
 }