[FFmpeg-cvslog] nutdec: add malloc check and fix const to non-const conversion warnings
Mans Rullgard
git at videolan.org
Thu Apr 19 21:45:51 CEST 2012
ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Wed Apr 18 20:48:36 2012 +0100| [9d72c0527c5b3dbfdf4a8cad3f306b2891dc3ea9] | committer: Mans Rullgard
nutdec: add malloc check and fix const to non-const conversion warnings
Signed-off-by: Mans Rullgard <mans at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d72c0527c5b3dbfdf4a8cad3f306b2891dc3ea9
---
libavformat/nutdec.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 004a2ea..f3cb4d8 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -305,14 +305,18 @@ static int decode_main_header(NUTContext *nut)
GET_V(nut->header_count, tmp < 128U)
nut->header_count++;
for (i = 1; i < nut->header_count; i++) {
+ uint8_t *hdr;
GET_V(nut->header_len[i], tmp > 0 && tmp < 256);
rem -= nut->header_len[i];
if (rem < 0) {
av_log(s, AV_LOG_ERROR, "invalid elision header\n");
return AVERROR_INVALIDDATA;
}
- nut->header[i] = av_malloc(nut->header_len[i]);
- avio_read(bc, nut->header[i], nut->header_len[i]);
+ hdr = av_malloc(nut->header_len[i]);
+ if (!hdr)
+ return AVERROR(ENOMEM);
+ avio_read(bc, hdr, nut->header_len[i]);
+ nut->header[i] = hdr;
}
assert(nut->header_len[0] == 0);
}
More information about the ffmpeg-cvslog
mailing list