commit:     de8d2c8de7d456a15f83551bfc3fcf6ff1fffaf1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 27 23:37:43 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 27 23:37:43 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=de8d2c8d

install-qa-check.d/90gcc-warnings: add -Wmismatched-dealloc

These could easily lead to UAFs / out of bound access if the
malloc used is oversized (e.g. using my_free() on something
allocated by malloc(), with my_free() assuming existence
of some extra data from my_malloc()).

Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/install-qa-check.d/90gcc-warnings | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/install-qa-check.d/90gcc-warnings 
b/bin/install-qa-check.d/90gcc-warnings
index 256e6918b..3a57c0a3b 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -66,6 +66,9 @@ gcc_warn_check() {
                        'warning: .*\[-Waggressive-loop-optimizations\]'
                        # conversion between pointers that have incompatible 
types
                        'warning: .*\[-Wincompatible-pointer-types\]'
+                       # using wrong deallocator, e.g. using free() on object 
allocated using my_malloc()
+                       # when my_malloc() is annotated as needing my_free().
+                       'warning: .*\[-Wmismatched-dealloc\]'
                        # clobbered: Warn for variables that might be changed 
by longjmp or vfork
                        # (This warning is also enabled by -Wextra.)
                        'warning: .*\[-Wclobbered\]'

Reply via email to