[all-commits] [llvm/llvm-project] 9c8f88: sanitizer_common: prepare for enabling format stri...

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Fri Aug 13 04:44:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c8f888f5fcafe8a9b69e7d652dc7328612f8ec6
      https://github.com/llvm/llvm-project/commit/9c8f888f5fcafe8a9b69e7d652dc7328612f8ec6
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-08-13 (Fri, 13 Aug 2021)

  Changed paths:
    M compiler-rt/CMakeLists.txt
    M compiler-rt/cmake/config-ix.cmake
    M compiler-rt/lib/sanitizer_common/sanitizer_common.h
    M compiler-rt/lib/sanitizer_common/sanitizer_libc.h
    M compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp

  Log Message:
  -----------
  sanitizer_common: prepare for enabling format string checking

The __attribute__((format)) was added somewhere in 2012,
the lost during refactoring, then re-added in 2014 but
to te source files, which is a no-op.
Move it back to header files so that it actually takes effect.
But over the past 7 years we've accumulated whole lot of
format string bugs of different types, so disable the warning
with -Wno-format for now for incremental clean up.

Among the bugs that it warns about are all kinds of bad things:
 - wrong sizes of arguments
 - missing/excessive arguments
 - printing wrong things (e.g. *ptr instead of ptr)
 - completely messed up format strings
 - security issues where external string is used as format

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D107977




More information about the All-commits mailing list