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@niedermayer.cc>
(cherry picked from commit 5f2b360fc0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-01-21 01:35:52 +01:00
parent eac727a502
commit a0a20e6994
1 changed files with 2 additions and 0 deletions

View File

@ -817,6 +817,8 @@ static void swap_samplerates_on_filter(AVFilterContext *filter)
for (j = 0; j < outlink->in_samplerates->nb_formats; j++) { for (j = 0; j < outlink->in_samplerates->nb_formats; j++) {
int diff = abs(sample_rate - outlink->in_samplerates->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) { if (diff < best_diff) {
best_diff = diff; best_diff = diff;
best_idx = j; best_idx = j;