From e95e8b5c6f792eafb098ff6fd1157d3ff6218a5f Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 26 Feb 2026 08:42:24 +0100 Subject: [PATCH] build: Add -fstack-protector-strong compiler flag Enable stack protection to detect buffer overflows and harden the binary. This flag adds a canary to stack frames, causing the program to terminate immediately if stack corruption is detected. This helps identify memory safety bugs earlier during development by turning silent corruption into an immediate crash, and provides protection against stack-smashing exploits at runtime with negligible performance overhead. We don't add this generally because we wan't distributions/users to decide if they want it. But it can help us find problems early on during development. --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index ccec068d..6861e75b 100644 --- a/meson.build +++ b/meson.build @@ -65,6 +65,7 @@ if is_debug '-Wunused', '-Wall', '-Wextra', + '-fstack-protector-strong' ], language: 'c') endif