summaryrefslogtreecommitdiff
path: root/libavformat/nsvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-31 01:14:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-31 02:46:26 +0100
commit151ecc2aecd81718e2520936dd3c537d7e6fe2fc (patch)
treed30c9048773a1138a4567fead3fd2c440db745bc /libavformat/nsvdec.c
parentb8c16558828e73e933ae73b5888345d50e897dfc (diff)
parentd7edd359ec28142120eb7fde77b775309b6038d8 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (26 commits) avconv: deprecate the -deinterlace option doc: Fix the name of the new function aacenc: make sure to encode enough frames to cover all input samples. aacenc: only use the number of input samples provided by the user. wmadec: Verify bitstream size makes sense before calling init_get_bits. kmvc: Log into a context at a log level constant. mpeg12: Pad framerate tab to 16 entries. kgv1dec: Increase offsets array size so it is large enough. kmvc: Check palsize. nsvdec: Propagate errors nsvdec: Be more careful with av_malloc(). nsvdec: Fix use of uninitialized streams. movenc: cosmetics: Get rid of camelCase identifiers swscale: more generic check for planar destination formats with alpha doc: Document mov/mp4 fragmentation options build: Use order-only prerequisites for creating FATE reference file dirs. x86 dsputil: provide SSE2/SSSE3 versions of bswap_buf rtsp: Remove some unused variables from ff_rtsp_connect(). avutil: make intfloat api public avformat_write_header(): detail error message ... Conflicts: doc/APIchanges doc/ffmpeg.texi doc/muxers.texi ffmpeg.c libavcodec/kmvc.c libavcodec/x86/Makefile libavcodec/x86/dsputil_yasm.asm libavcodec/x86/pngdsp-init.c libavformat/movenc.c libavformat/movenc.h libavformat/mpegtsenc.c libavformat/nsvdec.c libavformat/utils.c libavutil/avutil.h libswscale/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/nsvdec.c')
-rw-r--r--libavformat/nsvdec.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 50fbca98c2..d581cfb50e 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -313,7 +313,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
char *token, *value;
char quote;
- p = strings = av_mallocz(strings_size + 1);
+ p = strings = av_mallocz((size_t)strings_size + 1);
if (!p)
return AVERROR(ENOMEM);
endp = strings + strings_size;
@@ -350,6 +350,8 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
if((unsigned)table_entries_used >= UINT_MAX / sizeof(uint32_t))
return -1;
nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t));
+ if (!nsv->nsvs_file_offset)
+ return AVERROR(ENOMEM);
for(i=0;i<table_entries_used;i++)
nsv->nsvs_file_offset[i] = avio_rl32(pb) + size;
@@ -357,6 +359,8 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
if(table_entries > table_entries_used &&
avio_rl32(pb) == MKTAG('T','O','C','2')) {
nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t));
+ if (!nsv->nsvs_timestamps)
+ return AVERROR(ENOMEM);
for(i=0;i<table_entries_used;i++) {
nsv->nsvs_timestamps[i] = avio_rl32(pb);
}
@@ -527,11 +531,16 @@ static int nsv_read_header(AVFormatContext *s)
for (i = 0; i < NSV_MAX_RESYNC_TRIES; i++) {
if (nsv_resync(s) < 0)
return -1;
- if (nsv->state == NSV_FOUND_NSVF)
+ if (nsv->state == NSV_FOUND_NSVF) {
err = nsv_parse_NSVf_header(s);
+ if (err < 0)
+ return err;
+ }
/* we need the first NSVs also... */
if (nsv->state == NSV_FOUND_NSVS) {
err = nsv_parse_NSVs_header(s);
+ if (err < 0)
+ return err;
break; /* we just want the first one */
}
}