[FFmpeg-devel] [PATCH 1/3] avutil/tx: avoid negative left shifts

Michael Niedermayer michael at niedermayer.cc
Wed May 5 00:05:02 EEST 2021


Fixes: left shift of negative value -1
Fixes: 33736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SIREN_fuzzer-6657785795313664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavutil/tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index 8da04e99ca..25adb6b37e 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -97,9 +97,9 @@ static inline int split_radix_permutation(int i, int m, int inverse)
     if (m <= 1)
         return i & 1;
     if (!(i & m))
-        return (split_radix_permutation(i, m, inverse) << 1);
+        return split_radix_permutation(i, m, inverse) * 2;
     m >>= 1;
-    return (split_radix_permutation(i, m, inverse) << 2) + 1 - 2*(!(i & m) ^ inverse);
+    return split_radix_permutation(i, m, inverse) * 4 + 1 - 2*(!(i & m) ^ inverse);
 }
 
 int ff_tx_gen_ptwo_revtab(AVTXContext *s, int invert_lookup)
-- 
2.17.1



More information about the ffmpeg-devel mailing list