[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 14:08:27 PDT 2023


hazohelet created this revision.
hazohelet added reviewers: aaron.ballman, nickdesaulniers, serge-sans-paille.
Herald added a project: All.
hazohelet requested review of this revision.
Herald added a project: clang.

The wrong handling of %x specifier with alternative form causes a false positive in linux kernel (https://github.com/ClangBuiltLinux/linux/issues/1923#issuecomment-1696075886)

The kernel code: https://github.com/torvalds/linux/blob/651a00bc56403161351090a9d7ddbd7095975324/drivers/media/pci/cx18/cx18-mailbox.c#L99

This patch fixes this handling, and also adds some standard wordings as comments to clarify the reason.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159138

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Sema/warn-fortify-source.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159138.554484.patch
Type: text/x-patch
Size: 6035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230829/ab83c1c6/attachment-0001.bin>


More information about the cfe-commits mailing list