| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
"consuming data arguments"
Reviewers: rsmith, bruno, dexonsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D27796
llvm-svn: 289850
|
| |
|
|
|
|
|
| |
We were falling through from one case to another in a switch statement.
Oops.
llvm-svn: 282124
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The warning for a format string not being a string literal and therefore
being potentially insecure is overly strict for indices into string
literals. This fix checks if the index into the string literal is
precomputable. If that's the case it will check if the suffix of that
string literal is a valid format string string literal. It will still
issue the aforementioned warning for out of range indices into the
string literal.
Patch by Meike Baumgärtner (meikeb)
Reviewers: rsmith
Subscribers: srhines, cfe-commits
Differential Revision: https://reviews.llvm.org/D24584
llvm-svn: 281686
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Summary: This reverts r281527 because I messed up the attribution.
Reviewers: srhines
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D24579
llvm-svn: 281530
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The warning for a format string not being a sting literal and therefore
being potentially insecure is overly strict for indecies into sting
literals. This fix checks if the index into the string literal is
precomputable. If thats the case it will check if the suffix of that
sting literal is a valid format string string literal. It will still
issue the aforementioned warning for out of range indecies into the
string literal.
Reviewers: rsmith
Subscribers: srhines, cfe-commits
Differential Revision: https://reviews.llvm.org/D23820
llvm-svn: 281527
|
| |
|
|
|
|
|
|
|
|
| |
Followup from r264752.
Attempt to appease buildbots:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/2882
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2619
llvm-svn: 264765
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve invalid format string specifier handling by printing out
invalid specifiers characters with \x, \u and \U. Previously clang
would print gargabe whenever the character is unprintable.
Example, before:
NSLog(@"%\u25B9"); => warning: invalid conversion specifier ' [-Wformat-invalid-specifier]
after:
NSLog(@"%\u25B9"); => warning: invalid conversion specifier '\u25b9' [-Wformat-invalid-specifier]
Differential Revision: http://reviews.llvm.org/D18296
rdar://problem/24672159
llvm-svn: 264752
|
| |
|
|
|
|
|
|
| |
r263299 added a fixit for the -Wformat-security warning, but that runs
into complications with our guideline that error recovery should be done
as-if the fixit had been applied. Putting the fixit on a note avoids that.
llvm-svn: 263584
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The printf/scanf format checker is a little over-zealous in handling the conditional operator. This patch reduces work by not checking code-paths that are never used and reduces false positives regarding uncovered arguments, for example in the code fragment:
printf(minimal ? "%i\n" : "%i: %s\n", code, msg);
Reviewers: rtrieu
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D15636
llvm-svn: 262025
|
| |
|
|
| |
llvm-svn: 217327
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
glibc expects that stddef.h only defines a single thing if either of these
defines is set. For example, before this change, a C file containing
#include <stdlib.h>
int ptrdiff_t = 0;
would compile with gcc but not with clang. Now it compiles with clang too.
This also fixes PR12997, where older versions of the Linux headers would define
NULL incorrectly, and glibc would define __need_NULL and expect stddef.h to
redefine NULL with the correct definition.
llvm-svn: 207606
|
| |
|
|
|
|
|
|
| |
pathological cases.
PR18905.
llvm-svn: 201795
|
| |
|
|
|
|
|
| |
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.
llvm-svn: 196466
|
| |
|
|
|
|
| |
whether to emit a -Wformat-security warning. <rdar://problem/14178260>.
llvm-svn: 184214
|
| |
|
|
|
|
| |
Comment is taken from the commit message of r151080, by Jean-Daniel Dupas
llvm-svn: 172332
|
| |
|
|
|
|
|
| |
As a corollary to the previous commit, even when an extension is
available, we can still offer a fixit to the standard modifier.
llvm-svn: 163453
|
| |
|
|
|
|
|
|
|
| |
This seems to be a GNU libc extension; we offer a fixit to %lld on
these platforms.
<rdar://problem/11518237>
llvm-svn: 163452
|
| |
|
|
| |
llvm-svn: 161408
|
| |
|
|
|
|
|
| |
Warn about using pointers to const-qualified types as arguments to
scanf. Ignore the volatile qualifier when checking if types match.
llvm-svn: 161052
|
| |
|
|
|
|
|
|
| |
While '%n' can be used for evil in an attacker-controlled format string, there
isn't any acute danger in using it in a literal format string with an argument
of the appropriate type.
llvm-svn: 160984
|
| |
|
|
|
|
|
| |
This makes Clang check that the corresponding argument for "%n" in a
format string is a pointer to int.
llvm-svn: 160966
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
about argument type mismatch.
This gives a nicer diagnostic in cases like
printf(fmt,
i);
where previously the snippet just pointed at 'fmt' (with a note at the
definition of fmt).
It's a wash for cases like
printf("%f",
i);
where previously we snippeted the offending portion of the format string,
but didn't indicate which argument was at fault.
llvm-svn: 156968
|
| |
|
|
| |
llvm-svn: 156653
|
| |
|
|
| |
llvm-svn: 156597
|
| |
|
|
|
|
|
|
|
| |
For "%hhx", printf expects an unsigned char. This makes Clang
accept a 'char' argument for that also when using -funsigned-char.
This fixes PR12761.
llvm-svn: 156388
|
| |
|
|
|
|
|
|
|
|
| |
them both for ARM and X86.
Use this to fully fix Sema/format-strings.c for non-x86 platforms.
Reviewed by Chandler on IRC.
llvm-svn: 156169
|
| |
|
|
|
|
|
|
|
|
|
|
| |
promotion of wchar_t - they may differ in signedness.
Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned.
There'll be a followup commit to fix that.
Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8
llvm-svn: 156165
|
| |
|
|
| |
llvm-svn: 156132
|
| |
|
|
|
|
|
|
|
| |
This adds the -Wformat-non-standard flag (off by default,
enabled by -pedantic), which warns about non-standard
things in format strings (such as the 'q' length modifier,
the 'S' conversion specifier, etc.)
llvm-svn: 151154
|
| |
|
|
|
|
| |
warn if the format string argument is a parameter that is not itself declared as a format string with compatible format.
llvm-svn: 151080
|
| |
|
|
|
|
|
|
|
| |
This is in preparation for being able to warn about 'q' and other
non-standard format string features.
It also allows us to print its name correctly.
llvm-svn: 150697
|
| |
|
|
|
|
|
| |
This makes the printf diagnostics issue warnigns for %a, %A, %e, etc.
when used with the wrong argument.
llvm-svn: 150370
|
| |
|
|
| |
llvm-svn: 150009
|
| |
|
|
| |
llvm-svn: 149394
|
| |
|
|
|
|
|
| |
- Remove the printf0 special handling as we treat it as printf anyway.
- Perform basic checks (non-literal, empty) for all formats and not only printf/scanf.
llvm-svn: 149236
|
| |
|
|
|
|
| |
Fixes PR 9466.
llvm-svn: 148859
|
| |
|
|
|
|
| |
to GCC's).
llvm-svn: 148579
|
| |
|
|
|
|
|
|
|
|
|
| |
string is part of the function call, then there is no difference. If the
format string is not, the warning will point to the call site and a note
will point to where the format string is.
Fix-it hints for strings are moved to the note if a note is emitted. This will
prevent changes to format strings that may be used in multiple places.
llvm-svn: 143168
|
| |
|
|
|
|
| |
accept any char, not just signed char. Fixes <rdar://problem/10303638>.
llvm-svn: 142908
|
| |
|
|
|
|
| |
Fixes <rdar://problem/9473155>.
llvm-svn: 140777
|
| |
|
|
|
|
| |
(-Wformat-invalid-specifier) of -Wformat. Fixes <rdar://problem/10031930>.
llvm-svn: 138686
|
| |
|
|
|
|
| |
thing to do.
llvm-svn: 135152
|
| |
|
|
|
|
| |
cases to be more portable with an explicit target triple.
llvm-svn: 135134
|
| |
|
|
|
|
| |
conversion specifiers. My recent change was a mistake.
llvm-svn: 135048
|
| |
|
|
|
|
| |
specifiers for character types.
llvm-svn: 135046
|
| |
|
|
|
|
|
| |
either imlicitly (for builtins) or explicitly (due to multiple
specification of the same attributes). Fixes <rdar://problem/9612060>.
llvm-svn: 133045
|
| |
|
|
|
|
|
|
| |
never can be a real security issue.
Fixes PR 9314.
llvm-svn: 126447
|
| |
|
|
|
|
|
|
| |
-Wformat-security on -Wformat, not vice-versa.
Fixes PR8486. Patch by Oleg Slezberg.
llvm-svn: 126096
|
| |
|
|
|
|
|
| |
prefix in a printf format string is matched
with the appropriate conversion specifier.
llvm-svn: 123055
|
| |
|
|
|
|
| |
prefix to format conversions (POSIX extension).
llvm-svn: 123054
|