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

Git pushed a commit to branch master
in repository ffmpeg.

commit 289595a834ecd2ffcc3022d8a445ef3827c4de9c
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Tue Jul 28 01:40:12 2026 +0200
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Sun Aug 9 16:28:28 2026 +0200

    tests/checkasm/av_tx: Fix segfault when using --repeat
    
    The TX tests require a context that is initialized
    for a specific set of CPU flags. So in order to have
    a context for the reference function to use, the last
    context is stored (in static storage). This works well
    in normal usage, but it does not work with the --repeat
    feature that has been added to checkasm by the switch
    to libcheckasm: When the C functions ought to be tested
    a second time, there is a mismatch between the new
    function pointer (which is the C version) and the reference
    context (which is initialized to optimized CPU flags;
    up until now, there was no stored context when testing
    the C versions, but there is with --repeat), leading to segfaults.
    
    Fix this by adding an uninit callback for the TX test,
    replacing the atexit handler.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 tests/checkasm/av_tx.c    | 8 +-------
 tests/checkasm/checkasm.c | 2 +-
 tests/checkasm/checkasm.h | 2 ++
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/tests/checkasm/av_tx.c b/tests/checkasm/av_tx.c
index 2d7b4e662d..3bc66edf25 100644
--- a/tests/checkasm/av_tx.c
+++ b/tests/checkasm/av_tx.c
@@ -45,9 +45,8 @@ static const int check_lens[] = {
 };
 
 static AVTXContext *tx_refs[AV_TX_NB][2 /* Direction 
*/][FF_ARRAY_ELEMS(check_lens)] = { 0 };
-static int init = 0;
 
-static void free_tx_refs(void)
+void checkasm_uninit_tx(void)
 {
     for (int i = 0; i < FF_ARRAY_ELEMS(tx_refs); i++)
         for (int j = 0; j < FF_ARRAY_ELEMS(*tx_refs); j++)
@@ -121,9 +120,4 @@ void checkasm_check_av_tx(void)
     av_free(in);
     av_free(out_ref);
     av_free(out_new);
-
-    if (!init) {
-        init = 1;
-        atexit(free_tx_refs);
-    }
 }
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index a8cad59d4c..d394d3c61a 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -307,7 +307,7 @@ static const CheckasmTest tests[] = {
 #if CONFIG_PIXELUTILS
         { "pixelutils",checkasm_check_pixelutils },
 #endif
-        { "av_tx",     checkasm_check_av_tx },
+        { "av_tx",     checkasm_check_av_tx, .uninit = checkasm_uninit_tx },
 #endif
     { NULL }
     /* NOTE: When adding a new test to this list here, it also needs to be
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 5ba4080d69..221c0e220a 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -128,6 +128,8 @@ void checkasm_check_vvc_alf(void);
 void checkasm_check_vvc_mc(void);
 void checkasm_check_vvc_sao(void);
 
+void checkasm_uninit_tx(void);
+
 #define rnd checkasm_rand_uint32
 #define declare_func_float declare_func
 #define bench(...) checkasm_bench(__VA_ARGS__)

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

Reply via email to