[FFmpeg-cvslog] avfilter: Error out from avfilter_merge_formats() when there are duplicates
Michael Niedermayer
git at videolan.org
Wed Nov 23 14:41:05 CET 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 23 14:14:01 2011 +0100| [248bb81ebcbf715f589cc244076196d9c52cbf35] | committer: Michael Niedermayer
avfilter: Error out from avfilter_merge_formats() when there are duplicates
instead of trying to continue.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=248bb81ebcbf715f589cc244076196d9c52cbf35
---
libavfilter/formats.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index c626b38..ff4d49d 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -57,8 +57,13 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
for (i = 0; i < a->format_count; i++)
for (j = 0; j < b->format_count; j++)
if (a->formats[i] == b->formats[j]){
+ if(k >= FFMIN(a->format_count, b->format_count)){
+ av_log(0, AV_LOG_ERROR, "Duplicate formats in avfilter_merge_formats() detected\n");
+ av_free(ret->formats);
+ av_free(ret);
+ return NULL;
+ }
ret->formats[k++] = a->formats[i];
- break;
}
ret->format_count = k;
More information about the ffmpeg-cvslog
mailing list