aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2016-06-03 12:14:50 -0400
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-06-06 11:56:21 -0400
commit20a8c78ce0a5baf37f6a94e2d1e57e186b6f4b54 (patch)
tree17df4e759c4fe6b1fc041a00ee5cfbb24f76984d
parent38f99017e69bd25e88be87117237c29727c25635 (diff)
downloadffmpeg-20a8c78ce0a5baf37f6a94e2d1e57e186b6f4b54.tar.gz
avconv: Do not copy extradata if source buffer is empty
Fixes clang-usan runtime error "null pointer passed as argument 2, which is declared to never be null" while streamcopying. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
-rw-r--r--avconv.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/avconv.c b/avconv.c
index d8631036a1..2e3bde925e 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1875,12 +1875,15 @@ static int transcode_init(void)
par_dst->bit_rate = par_src->bit_rate;
par_dst->field_order = par_src->field_order;
par_dst->chroma_location = par_src->chroma_location;
- par_dst->extradata = av_mallocz(extra_size);
- if (!par_dst->extradata) {
- return AVERROR(ENOMEM);
+ if (par_src->extradata != NULL) {
+ par_dst->extradata = av_mallocz(extra_size);
+ if (!par_dst->extradata) {
+ return AVERROR(ENOMEM);
+ }
+ memcpy(par_dst->extradata, par_src->extradata,
+ par_src->extradata_size);
+ par_dst->extradata_size = par_src->extradata_size;
}
- memcpy(par_dst->extradata, par_src->extradata, par_src->extradata_size);
- par_dst->extradata_size = par_src->extradata_size;
ost->st->time_base = ist->st->time_base;