This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/8.1
in repository ffmpeg.

commit 9b88ec31419a5c11f16a63518a8bb1ea534cfb2d
Author:     Niklas Haas <[email protected]>
AuthorDate: Thu Jun 18 15:12:07 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sat Sep 19 16:59:28 2026 +0200

    avutil/rational: avoid signed integer overflow
    
    Passing -INT_MIN to av_sub_q() overflows due to the negation. Writing out
    the formula explicitly avoids this.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
    (cherry picked from commit 6a853ce3272b4520bdba3c12d2d1db9144c312c9)
---
 libavutil/rational.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/rational.c b/libavutil/rational.c
index 1b7c6350e9..fdb1da7f48 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -100,7 +100,11 @@ AVRational av_add_q(AVRational b, AVRational c) {
 
 AVRational av_sub_q(AVRational b, AVRational c)
 {
-    return av_add_q(b, (AVRational) { -c.num, c.den });
+    av_reduce(&b.num, &b.den,
+               b.num * (int64_t) c.den -
+               c.num * (int64_t) b.den,
+               b.den * (int64_t) c.den, INT_MAX);
+    return b;
 }
 
 AVRational av_d2q(double d, int max)

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to