]> git.sesse.net Git - ffmpeg/commitdiff
libswresample/audioconvert: Fix undefined NULL + 0
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 26 Mar 2021 08:43:22 +0000 (09:43 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 1 Apr 2021 12:15:20 +0000 (14:15 +0200)
Affected 26 FATE tests like swr-resample_async-s16p-44100-8000.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libswresample/audioconvert.c

index 89ee7bfae3b162f7fc97f278f8329feabddede74..500aa0e5c570efa9ad4a455a33caa17a9bd0bb18 100644 (file)
@@ -237,10 +237,10 @@ int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len
         const int ich= ctx->ch_map ? ctx->ch_map[ch] : ch;
         const int is= ich < 0 ? 0 : (in->planar ? 1 : in->ch_count) * in->bps;
         const uint8_t *pi= ich < 0 ? ctx->silence : in->ch[ich];
-        uint8_t       *po= out->ch[ch];
-        uint8_t *end= po + os*len;
+        uint8_t *end, *po = out->ch[ch];
         if(!po)
             continue;
+        end = po + os * len;
         ctx->conv_f(po+off*os, pi+off*is, is, os, end);
     }
     return 0;