diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-10 01:52:56 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-10 02:05:17 +0100 |
commit | b3928a1cc65462a72fea538fcf082cbc8f373e37 (patch) | |
tree | a377c88c7213de0778418acbe7fad65571e27a71 /libswresample/swresample.c | |
parent | 8258e363851434ad5662c19d036fddb3e3f27683 (diff) | |
download | ffmpeg-b3928a1cc65462a72fea538fcf082cbc8f373e37.tar.gz |
swresample/swresample: Check count before memcpy()
Fixes undefined operation
Fixes part of 668007-media
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswresample/swresample.c')
-rw-r--r-- | libswresample/swresample.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c index 0ef4dea91b..dea61391ac 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -413,9 +413,9 @@ int swri_realloc_audio(AudioData *a, int count){ return AVERROR(ENOMEM); for(i=0; i<a->ch_count; i++){ a->ch[i]= a->data + i*(a->planar ? countb : a->bps); - if(a->planar) memcpy(a->ch[i], old.ch[i], a->count*a->bps); + if(a->count && a->planar) memcpy(a->ch[i], old.ch[i], a->count*a->bps); } - if(!a->planar) memcpy(a->ch[0], old.ch[0], a->count*a->ch_count*a->bps); + if(a->count && !a->planar) memcpy(a->ch[0], old.ch[0], a->count*a->ch_count*a->bps); av_freep(&old.data); a->count= count; |