llvm/llvm-project

Create a check that warns about using %p printf specifier

Open

#43.453 geöffnet am 21. Nov. 2019

Auf GitHub ansehen
 (11 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (10.782 Forks)batch import
bugzillaclang:static analyzerenhancementgood first issue

Repository-Metriken

Stars
 (26.378 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 1T 2h) (1.000 gemergte PRs in 30 T)

Beschreibung

Bugzilla Link 44108
Version unspecified
OS Windows NT

Extended Description

Recently I ran into some surprising behavior surrounding the use of %p in a printf call. On Windows %p with a nullptr prints zeros, but on Linux %p with a nullptr prints "(nil)". This is surprising, but conforming to the standard which states (roughly) that the result of %p is implementation dependent.

Create a check that warns about the potential non-portable output when using %p in a printf or scanf specifier.

Contributor Guide