sna.h uses jmp_buf instead of sigjmp_buf with sigsetjmp()
Compiling from git (commit b74b67f0) with gcc 13.2 on Solaris 11.4 on x86-64 reports:
sna.h:1371:23: warning: ‘sigsetjmp’ accessing 1024 bytes in a region of size 256 [-Wstringop-overflow=]
1371 | #define sigtrap_get() sigsetjmp(sigjmp[sigtrap++], 1)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sna_blt.c:2455:24: note: in expansion of macro ‘sigtrap_get’
2455 | return sigtrap_get() == 0;
| ^~~~~~~~~~~
sna.h:1371:23: note: referencing argument 1 of type ‘long int[128]’
1371 | #define sigtrap_get() sigsetjmp(sigjmp[sigtrap++], 1)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sna_blt.c:2455:24: note: in expansion of macro ‘sigtrap_get’
2455 | return sigtrap_get() == 0;
| ^~~~~~~~~~~
In file included from sna.h:77:
This is because src/sna/sna.h declares:
extern jmp_buf sigjmp[4];
with a corresponding definition in src/sna/sna_accel.c.
But sigsetjmp
requires a sigjmp_buf
instead, and while some implementations declare them to be the same size, there's no requirement that they do so, and the Solaris ABI's require that sigjmp_buf
be significantly larger than the older jmp_buf
.
This small patch fixes the issue:
diff --git a/src/sna/sna.h b/src/sna/sna.h
index f08f4d23..379197ae 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -1363,7 +1363,7 @@ void sna_image_composite(pixman_op_t op,
uint16_t width,
uint16_t height);
-extern jmp_buf sigjmp[4];
+extern sigjmp_buf sigjmp[4];
extern volatile sig_atomic_t sigtrap;
#define sigtrap_assert_inactive() assert(sigtrap == 0)
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 89b82afa..0845a842 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -440,7 +440,7 @@ static void assert_pixmap_damage(PixmapPtr p)
#endif
#endif
-jmp_buf sigjmp[4];
+sigjmp_buf sigjmp[4];
volatile sig_atomic_t sigtrap;
static int sigtrap_handler(int sig)