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 6bb0f2ae77e68f500cedec90f8f092aa78313426
Author:     Ayoub Nabil Boubagrat 
<[email protected]>
AuthorDate: Thu Aug 27 20:17:09 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sat Sep 19 14:27:10 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 a89f3d1670..c609d14ded 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -662,8 +662,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;
 }
@@ -673,9 +674,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;
 }
@@ -991,7 +994,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