[FFmpeg-cvslog] avcodec/ffv1enc: Fix undefined left shifts of negative numbers

Andreas Rheinhardt git at videolan.org
Mon May 30 20:51:40 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon May 30 18:26:40 2022 +0200| [415f012359364a77e8394436f222b74a8641a3ee] | committer: Andreas Rheinhardt

avcodec/ffv1enc: Fix undefined left shifts of negative numbers

Maybe this fixes the FPE encountered here:
https://fate.ffmpeg.org/report.cgi?slot=alpha-debian-qemu-gcc-4.7&time=20220530144951

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/ffv1enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 311f377b1e..9849082e44 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -143,7 +143,7 @@ static void find_best_state(uint8_t best_state[256][256],
     uint32_t l2tab[256];
 
     for (i = 1; i < 256; i++)
-        l2tab[i] = log2(i / 256.0) * ((-1<<31) / 8);
+        l2tab[i] = -log2(i / 256.0) * ((1U << 31) / 8);
 
     for (i = 0; i < 256; i++) {
         uint64_t best_len[256];



More information about the ffmpeg-cvslog mailing list