The branch, master has been updated
       via  5a893c180630fe56e027f0f41f2ef04d8309d11f (commit)
      from  a0e00bed88cc06b109e446a8f79833b595dba03a (commit)


- Log -----------------------------------------------------------------
commit 5a893c180630fe56e027f0f41f2ef04d8309d11f
Author:     Martin Storsjö <[email protected]>
AuthorDate: Tue Sep 2 14:10:28 2025 +0300
Commit:     Martin Storsjö <[email protected]>
CommitDate: Tue Sep 2 14:28:56 2025 +0300

    checkasm: sw_ops: Avoid division by zero
    
    If we're invoked with range == UINT_MAX, we end up doing
    "rnd() % (UINT_MAX + 1)", which is equal to "rnd() % 0". On
    arm (on all platforms) and on MSVC i386, this ends up crashing
    at runtime.
    
    This fixes the crash.

diff --git a/tests/checkasm/sw_ops.c b/tests/checkasm/sw_ops.c
index 35ade0c751..57fd501fa1 100644
--- a/tests/checkasm/sw_ops.c
+++ b/tests/checkasm/sw_ops.c
@@ -80,7 +80,7 @@ static void fill32f(float *line, int num, unsigned range)
 static void fill32(uint32_t *line, int num, unsigned range)
 {
     for (int i = 0; i < num; i++)
-        line[i] = range ? rnd() % (range + 1) : rnd();
+        line[i] = (range && range < UINT_MAX) ? rnd() % (range + 1) : rnd();
 }
 
 static void fill16(uint16_t *line, int num, unsigned range)

-----------------------------------------------------------------------

Summary of changes:
 tests/checkasm/sw_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


hooks/post-receive
-- 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to