[FFmpeg-cvslog] avfilter/avfiltergraph: Add assert to write down in machine readable form what is assumed about sample rates in swap_samplerates_on_filter ()

Michael Niedermayer git at videolan.org
Sat Jan 21 03:52:24 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Jan 21 01:35:52 2017 +0100| [5f2b360fc05bbb4f21e1247d1d9af303113d6c25] | committer: Michael Niedermayer

avfilter/avfiltergraph: Add assert to write down in machine readable form what is assumed about sample rates in swap_samplerates_on_filter()

Fixes CID1397292

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f2b360fc05bbb4f21e1247d1d9af303113d6c25
---

 libavfilter/avfiltergraph.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 97f242e..534c670 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -876,6 +876,8 @@ static void swap_samplerates_on_filter(AVFilterContext *filter)
         for (j = 0; j < outlink->in_samplerates->nb_formats; j++) {
             int diff = abs(sample_rate - outlink->in_samplerates->formats[j]);
 
+            av_assert0(diff < INT_MAX); // This would lead to the use of uninitialized best_diff but is only possible with invalid sample rates
+
             if (diff < best_diff) {
                 best_diff = diff;
                 best_idx  = j;



More information about the ffmpeg-cvslog mailing list