ffmpeg | branch: release/5.1 | Michael Niedermayer <mich...@niedermayer.cc> | 
Sun Jan 22 00:51:05 2023 +0100| [66192786e7abc7fc4b303243676df175df388e2a] | 
committer: Michael Niedermayer

avutil/tx_priv: Use unsigned in BF() to avoid signed overflows

Fixes: signed integer overflow: 100183269 - -2132769113 cannot be represented 
in type 'int'
Fixes: 
55063/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5039294027005952

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
(cherry picked from commit eddf7e2a3e9459fd26a76fb2984a6c9b994e2d89)
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

 libavutil/tx_priv.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index 3dd748bd2c..6acbede0f4 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -101,6 +101,12 @@ typedef void TXComplex;
 
 #define FOLD(a, b) ((a) + (b))
 
+#define BF(x, y, a, b)  \
+    do {                \
+        x = (a) - (b);  \
+        y = (a) + (b);  \
+    } while (0)
+
 #elif defined(TX_INT32)
 
 /* Properly rounds the result */
@@ -131,14 +137,14 @@ typedef void TXComplex;
 
 #define FOLD(x, y) ((int32_t)((x) + (unsigned)(y) + 32) >> 6)
 
-#endif /* TX_INT32 */
-
 #define BF(x, y, a, b)  \
     do {                \
-        x = (a) - (b);  \
-        y = (a) + (b);  \
+        x = (a) - (unsigned)(b);  \
+        y = (a) + (unsigned)(b);  \
     } while (0)
 
+#endif /* TX_INT32 */
+
 #define CMUL3(c, a, b) CMUL((c).re, (c).im, (a).re, (a).im, (b).re, (b).im)
 
 /* Codelet flags, used to pick codelets. Must be a superset of enum AVTXFlags,

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to