summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-23 14:14:01 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-23 14:14:01 +0100
commit248bb81ebcbf715f589cc244076196d9c52cbf35 (patch)
tree32c95c6b73970b8b8f5e99e0aac79d23201c7545 /libavfilter
parent4d874fc2b1c3ef739fb2934c487b1ec649038f41 (diff)
avfilter: Error out from avfilter_merge_formats() when there are duplicates
instead of trying to continue. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/formats.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index c626b38c68..ff4d49dd5d 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;