This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6a853ce3272b4520bdba3c12d2d1db9144c312c9 Author: Niklas Haas <[email protected]> AuthorDate: Thu Jun 18 15:12:07 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Thu Jun 25 01:20:15 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]> --- 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) _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
