diff mbox series

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

Message ID 20210504210504.13396-1-michael@niedermayer.cc
State Accepted
Commit 85b883429fb1a8c1be2e39fee510315a92b6cd02
Headers show
Series [FFmpeg-devel,1/3] avutil/tx: avoid negative left shifts
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 4, 2021, 9:05 p.m. UTC
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@niedermayer.cc>
---
 libavutil/tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer June 17, 2021, 8:51 p.m. UTC | #1
On Tue, May 04, 2021 at 11:05:02PM +0200, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavutil/tx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply patchset

[...]
diff mbox series

Patch

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)