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

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

commit db019be35bb2cec5fc0e2a78ae4c4268971174e8
Author:     Ayoub Nabil Boubagrat 
<[email protected]>
AuthorDate: Thu Aug 27 20:17:09 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Fri Sep 4 21:54:00 2026 +0200

    avcodec/wavpackenc: handle INT32_MIN samples
    
    abs() cannot represent the magnitude of INT32_MIN. labs() has the same 
issue on platforms where long is 32 bits. use FFABSU for the full signed sample 
range.
    
    Signed-off-by: Ayoub Nabil Boubagrat 
<[email protected]>
    (cherry picked from commit 4021d0d193932c65cc03a210da7a44c773ce36a5)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/wavpackenc.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index 12010d699b..17372b74a5 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -663,8 +663,9 @@ static uint32_t log2mono(int32_t *samples, int nb_samples, 
int limit)
 {
     uint32_t result = 0;
     while (nb_samples--) {
-        if (log2sample(abs(*samples++), limit, &result))
+        if (log2sample(FFABSU(samples[0]), limit, &result))
             return UINT32_MAX;
+        samples++;
     }
     return result;
 }
@@ -674,9 +675,11 @@ static uint32_t log2stereo(int32_t *samples_l, int32_t 
*samples_r,
 {
     uint32_t result = 0;
     while (nb_samples--) {
-        if (log2sample(abs(*samples_l++), limit, &result) ||
-            log2sample(abs(*samples_r++), limit, &result))
+        if (log2sample(FFABSU(samples_l[0]), limit, &result) ||
+            log2sample(FFABSU(samples_r[0]), limit, &result))
             return UINT32_MAX;
+        samples_l++;
+        samples_r++;
     }
     return result;
 }
@@ -992,7 +995,7 @@ static void scan_word(WavPackEncodeContext *s, WvChannel *c,
         samples += nb_samples - 1;
 
     while (nb_samples--) {
-        uint32_t low, value = labs(samples[0]);
+        uint32_t low, value = FFABSU(samples[0]);
 
         if (value < GET_MED(0)) {
             DEC_MED(0);

-- 
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