From 42364fcbcac99c42a9859c3662a2956e5554b68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 15 Jan 2013 15:19:55 +0200 Subject: [PATCH 1/2] srtp: Mark a few variables as uninitialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This squelches false positive warnings (with gcc) about them being used uninitalized. Signed-off-by: Martin Storsjö --- libavformat/srtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/srtp.c b/libavformat/srtp.c index de48c1461a..ebc5c98fd7 100644 --- a/libavformat/srtp.c +++ b/libavformat/srtp.c @@ -121,8 +121,8 @@ int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr) { uint8_t iv[16] = { 0 }, hmac[20]; int len = *lenptr; - int ext, seq_largest; - uint32_t ssrc, roc; + int ext, av_uninit(seq_largest); + uint32_t ssrc, av_uninit(roc); uint64_t index; int rtcp; From 977d4a3b8a2dbc2fb5e747c7072485016c9cdfaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 15 Jan 2013 15:27:30 +0200 Subject: [PATCH 2/2] rtpdec_mpeg4: Check the return value from malloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtpdec_mpeg4.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c index 13d051ae85..3cac29f8a3 100644 --- a/libavformat/rtpdec_mpeg4.c +++ b/libavformat/rtpdec_mpeg4.c @@ -137,6 +137,8 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf) if (!data->au_headers || data->au_headers_allocated < data->nb_au_headers) { av_free(data->au_headers); data->au_headers = av_malloc(sizeof(struct AUHeaders) * data->nb_au_headers); + if (!data->au_headers) + return AVERROR(ENOMEM); data->au_headers_allocated = data->nb_au_headers; } @@ -162,6 +164,7 @@ static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data, const uint8_t *buf, int len, uint16_t seq, int flags) { + int ret; if (rtp_parse_mp4_au(data, buf)) return -1; @@ -170,7 +173,8 @@ static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data, /* XXX: Fixme we only handle the case where rtp_parse_mp4_au define one au_header */ - av_new_packet(pkt, data->au_headers[0].size); + if ((ret = av_new_packet(pkt, data->au_headers[0].size)) < 0) + return ret; memcpy(pkt->data, buf, data->au_headers[0].size); pkt->stream_index = st->index;