Commit fffa9f94b for imagemagick.org

commit fffa9f94bf73f93b8c15d6e2b58542d8766d19b3
Author: Kévin Dunglas <kevin@dunglas.fr>
Date:   Sat Nov 28 12:16:32 2026 +0100

    Drop process-wide SIGBUS handler from matrix cache (#9159)

    SetMatrixExtent() replaced the process-wide SIGBUS handler with
    signal() and never restored it. The handler cannot recover: it calls
    ThrowFatalException(), which is not async-signal-safe, and exits.

    Commit 6e167ed08 removed the same handler from the pixel cache (see
    https://github.com/ImageMagick/ImageMagick/issues/777); the matrix
    copy was missed. Besides hijacking SIGBUS for the rest of the
    process, it overrides the handler that MagickCoreGenesis() registers
    for the CLI, which already cleans up temporary files, and it breaks
    Go programs embedding ImageMagick, since Go requires handlers
    installed by C code to use SA_ONSTACK.

    Co-authored-by: Cristy <12486802+urban-warrior@users.noreply.github.com>

diff --git a/MagickCore/matrix.c b/MagickCore/matrix.c
index 6a77631ea..2a5a214bc 100644
--- a/MagickCore/matrix.c
+++ b/MagickCore/matrix.c
@@ -124,14 +124,6 @@ struct _MatrixInfo
 %
 */

-#if defined(SIGBUS)
-static void MatrixSignalHandler(int magick_unused(status))
-{
-  magick_unreferenced(status);
-  ThrowFatalException(CacheFatalError,"UnableToExtendMatrixCache");
-}
-#endif
-
 static inline MagickOffsetType WriteMatrixElements(
   const MatrixInfo *magick_restrict matrix_info,const MagickOffsetType offset,
   const MagickSizeType length,const unsigned char *magick_restrict buffer)
@@ -180,9 +172,6 @@ static MagickBooleanType SetMatrixExtent(
 #if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)
   if (matrix_info->synchronize != MagickFalse)
     (void) posix_fallocate(matrix_info->file,offset+1,extent-offset);
-#endif
-#if defined(SIGBUS)
-  (void) signal(SIGBUS,MatrixSignalHandler);
 #endif
   return(count != (MagickOffsetType) 1 ? MagickFalse : MagickTrue);
 }