]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
meson: Enable -Wvla
authorPeter Maydell <peter.maydell@linaro.org>
Wed, 21 Feb 2024 16:26:36 +0000 (17:26 +0100)
committerThomas Huth <thuth@redhat.com>
Fri, 23 Feb 2024 07:13:52 +0000 (08:13 +0100)
QEMU has historically used variable length arrays only very rarely.
Variable length arrays are a potential security issue where an
on-stack dynamic allocation isn't correctly size-checked, especially
when the size comes from the guest.  (An example problem of this kind
from the past is CVE-2021-3527).  Forbidding them entirely is a
defensive measure against further bugs of this kind.

Enable -Wvla to prevent any new uses from sneaking into the codebase.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20240125173211.1786196-3-peter.maydell@linaro.org>
[thuth: rebased to current master branch]
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240221162636.173136-4-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
meson.build

index c1dc83e4c0074edba0223e6550153912c4af77aa..0ef1654e868404f464166d780ef55e6c9fb77fa9 100644 (file)
@@ -592,6 +592,7 @@ warn_flags = [
   '-Wstrict-prototypes',
   '-Wtype-limits',
   '-Wundef',
+  '-Wvla',
   '-Wwrite-strings',
 
   # Then disable some undesirable warnings