From patchwork Thu Feb 1 13:02:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: avpacket: Initialize the allocated padding area in side data X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 64159 Message-Id: <20180201130237.87681-1-martin@martin.st> To: libav-devel@libav.org Date: Thu, 1 Feb 2018 15:02:37 +0200 From: =?utf-8?q?Martin_Storsj=C3=B6?= List-Id: libav development This makes sure that consumers of the side data actually can rely on the padding as intended, without having the callers of av_packet_new_side_data to explicitly zero initialize it. --- libavcodec/avpacket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 93e9eb6ae7..c705df3d59 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -271,6 +271,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!data) return NULL; + memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = av_packet_add_side_data(pkt, type, data, size); if (ret < 0) {