| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 120735
|
|
|
|
| |
llvm-svn: 119946
|
|
|
|
|
|
|
|
|
|
| |
it was really a 'char'
or a 'short'. This fixes that and allows the hints to suggest 'h' modifiers for small ints.
Patch by Justin Bogner!
llvm-svn: 116996
|
|
|
|
|
|
| |
(one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>.
llvm-svn: 113472
|
|
|
|
|
|
|
|
| |
-Wformat-nonliteral, as
the function processing the format string can decided whether or not to accept a null format string (e.g., asl_log). Fixes <rdar://problem/8269537>.
llvm-svn: 113469
|
|
|
|
|
|
| |
compatible argument). Fixes PR 7981.
llvm-svn: 111978
|
|
|
|
|
|
|
|
| |
positional arguments, since
these don't actually consume an argument.
llvm-svn: 108757
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
http://llvm.org/bugs/show_bug.cgi?id=7377
Updated format string highlighting and fixits to take advantage of the new CharSourceRange class.
- Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag)
- Change format specifier range helper function to allow for half-open ranges (+1 to end)
- Enabled previously failing tests (FIXMEs/XFAILs removed)
- Small fixes and additions to format string test cases
M test/Sema/format-strings.c
M test/Sema/format-strings-fixit.c
M lib/Frontend/TextDiagnosticPrinter.cpp
M lib/Sema/SemaChecking.cpp
llvm-svn: 106480
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Added warning for undefined behavior when using field specifier
- Added warning for undefined behavior when using length modifier
- Fixed warnings for invalid flags
- Added warning for ignored flags
- Added fixits for the above warnings
- Fixed accuracy of detecting several undefined behavior conditions
- Receive normal warnings in addition to security warnings when using %n
- Fix bug where '+' flag would remain on unsigned conversion suggestions
Summary of changes:
- Added expanded tests
- Added/expanded warnings
- Added position info to OptionalAmounts for fixits
- Extracted optional flags to a wrapper class with position info for fixits
- Added several methods to validate a FormatSpecifier by component, each checking for undefined behavior
- Fixed conversion specifier checking to conform to C99 standard
- Added hooks to detect the invalid states in CheckPrintfHandler::HandleFormatSpecifier
Note: warnings involving the ' ' (space) flag are temporarily disabled until whitespace highlighting no longer triggers assertions. I will make a post about this on cfe-dev shortly.
M test/Sema/format-strings.c
M include/clang/Basic/DiagnosticSemaKinds.td
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
M lib/Sema/SemaChecking.cpp
llvm-svn: 106233
|