[FFmpeg-cvslog] avcodec/extract_extradata: zero initalize the padding bytes in all allocated buffers

James Almer git at videolan.org
Sat Mar 10 15:00:54 EET 2018


ffmpeg | branch: release/3.4 | James Almer <jamrial at gmail.com> | Fri Mar  9 13:00:55 2018 -0300| [c289f4b6c9390d5b2b6388b0d82d40af62ea7ce2] | committer: James Almer

avcodec/extract_extradata: zero initalize the padding bytes in all allocated buffers

Reviewed-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit d168e78effd170377ec57f67bca05c9f0de91bca)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c289f4b6c9390d5b2b6388b0d82d40af62ea7ce2
---

 libavcodec/extract_extradata_bsf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c
index d40907a675..fbfd12aeef 100644
--- a/libavcodec/extract_extradata_bsf.c
+++ b/libavcodec/extract_extradata_bsf.c
@@ -114,6 +114,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
             ret = AVERROR(ENOMEM);
             goto fail;
         }
+        memset(extradata + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 
         *data = extradata;
         *size = extradata_size;
@@ -137,6 +138,8 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
             pkt->buf  = filtered_buf;
             pkt->data = filtered_buf->data;
             pkt->size = filtered_data - filtered_buf->data;
+
+            memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
         }
     }
 
@@ -169,6 +172,7 @@ static int extract_extradata_vc1(AVBSFContext *ctx, AVPacket *pkt,
             return AVERROR(ENOMEM);
 
         memcpy(*data, pkt->data, extradata_size);
+        memset(*data + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
         *size = extradata_size;
 
         if (s->remove) {
@@ -199,6 +203,7 @@ static int extract_extradata_mpeg12(AVBSFContext *ctx, AVPacket *pkt,
                     return AVERROR(ENOMEM);
 
                 memcpy(*data, pkt->data, *size);
+                memset(*data + *size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 
                 if (s->remove) {
                     pkt->data += *size;
@@ -228,6 +233,7 @@ static int extract_extradata_mpeg4(AVBSFContext *ctx, AVPacket *pkt,
                     return AVERROR(ENOMEM);
 
                 memcpy(*data, pkt->data, *size);
+                memset(*data + *size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 
                 if (s->remove) {
                     pkt->data += *size;



More information about the ffmpeg-cvslog mailing list