diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-05 03:09:48 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-05 03:30:24 +0200 |
commit | b000b86e1dd03c4ff89cd63a6fa88fc280947c94 (patch) | |
tree | 8ba961dc8c013885d7bdfe944fb7cb31d5dc6d95 /libavformat | |
parent | 9a5624a0f1b205e966391645a512c6dccdce42cd (diff) | |
parent | af1ca249e8eb685823dd0dade3aa3c1d119a61ec (diff) | |
download | ffmpeg-b000b86e1dd03c4ff89cd63a6fa88fc280947c94.tar.gz |
Merge remote branch 'qatar/master'
* qatar/master: (23 commits)
doc: Check standalone compilation before submitting new components.
Fix standalone compilation of pipe protocol.
Fix standalone compilation of ac3_fixed encoder.
Fix standalone compilation of binkaudio_dct / binkaudio_rdft decoders.
Fix standalone compilation of IMC decoder.
Fix standalone compilation of WTV demuxer.
Fix standalone compilation of MXPEG decoder.
flashsv: K&R cosmetics
matroskaenc: fix memory leak
vc1: make overlap filter for I-frames bit-exact.
vc1dec: use s->start/end_mb_y instead of passing them as function args.
Revert "VC1: merge idct8x8, coeff adjustments and put_pixels."
Replace strncpy() with av_strlcpy().
indeo3: Eliminate use of long.
get_bits: make cache unsigned to eliminate undefined signed overflow.
asfdec: fix assert failure on invalid files
avfilter: check malloc return values.
Not pulled as reason for reindent is not pulled: mpegvideo: reindent.
nutenc: check malloc return values.
Not pulled due to much simpler solution in ffmpeg *: don't av_malloc(0).
...
Conflicts:
doc/developer.texi
libavcodec/Makefile
libavcodec/get_bits.h
libavcodec/mpegvideo.c
libavformat/Makefile
libavutil/log.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/Makefile | 3 | ||||
-rw-r--r-- | libavformat/asfdec.c | 14 | ||||
-rw-r--r-- | libavformat/file.c | 26 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 4 | ||||
-rw-r--r-- | libavformat/movenc.c | 2 | ||||
-rw-r--r-- | libavformat/mp3enc.c | 3 | ||||
-rw-r--r-- | libavformat/nutenc.c | 6 |
7 files changed, 38 insertions, 20 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile index a1a48b37a3..739decfd9f 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -299,7 +299,8 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ flacenc_header.o avlanguage.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o -OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asf.o asfdec.o mpegts.o riff.o +OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asfdec.o asf.o asfcrypt.o \ + avlanguage.o mpegts.o isom.o riff.o OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o OBJS-$(CONFIG_XA_DEMUXER) += xa.o OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o riff.o diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 63c18303c6..7d0409aa83 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -845,11 +845,21 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ if (asf->packet_flags & 0x01) { DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal if(asf->packet_frag_size > asf->packet_size_left - rsize){ - av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid\n"); - return -1; + if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { + av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize); + return -1; + } else { + int diff = asf->packet_frag_size - (asf->packet_size_left - rsize); + asf->packet_size_left += diff; + asf->packet_padsize -= diff; + } } //printf("Fragsize %d\n", asf->packet_frag_size); } else { + if (rsize > asf->packet_size_left) { + av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); + return -1; + } asf->packet_frag_size = asf->packet_size_left - rsize; //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); } diff --git a/libavformat/file.c b/libavformat/file.c index fc8d174119..a9c5281102 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -51,6 +51,19 @@ static int file_get_handle(URLContext *h) return (intptr_t) h->priv_data; } +static int file_check(URLContext *h, int mask) +{ + struct stat st; + int ret = stat(h->filename, &st); + if (ret < 0) + return AVERROR(errno); + + ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; + ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; + + return ret; +} + #if CONFIG_FILE_PROTOCOL static int file_open(URLContext *h, const char *filename, int flags) @@ -95,19 +108,6 @@ static int file_close(URLContext *h) return close(fd); } -static int file_check(URLContext *h, int mask) -{ - struct stat st; - int ret = stat(h->filename, &st); - if (ret < 0) - return AVERROR(errno); - - ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; - ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; - - return ret; -} - URLProtocol ff_file_protocol = { .name = "file", .url_open = file_open, diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 5e4552a09c..72631c7686 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -403,8 +403,6 @@ static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks) } end_ebml_master(pb, cues_element); - av_free(cues->entries); - av_free(cues); return currentpos; } @@ -1164,6 +1162,8 @@ static int mkv_write_trailer(AVFormatContext *s) end_ebml_master(pb, mkv->segment); av_free(mkv->tracks); + av_freep(&mkv->cues->entries); + av_freep(&mkv->cues); av_destruct_packet(&mkv->cur_audio_pkt); avio_flush(pb); return 0; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index eec61fed66..1b61706da3 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -829,7 +829,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) memset(compressor_name,0,32); /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) - strncpy(compressor_name,track->enc->codec->name,31); + av_strlcpy(compressor_name,track->enc->codec->name,32); avio_w8(pb, strlen(compressor_name)); avio_write(pb, compressor_name, 31); diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index dce3260a87..9b02050178 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -24,6 +24,7 @@ #include "id3v1.h" #include "id3v2.h" #include "rawenc.h" +#include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" @@ -32,7 +33,7 @@ static int id3v1_set_string(AVFormatContext *s, const char *key, { AVMetadataTag *tag; if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) - strncpy(buf, tag->value, buf_size); + av_strlcpy(buf, tag->value, buf_size); return !!tag; } diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 47eaa2c81c..b5c5c7e532 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -589,6 +589,12 @@ static int write_header(AVFormatContext *s){ nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters); nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams + s->nb_chapters)); + if (!nut->stream || (s->nb_chapters && !nut->chapter) || !nut->time_base) { + av_freep(&nut->stream); + av_freep(&nut->chapter); + av_freep(&nut->time_base); + return AVERROR(ENOMEM); + } for(i=0; i<s->nb_streams; i++){ AVStream *st= s->streams[i]; |