etienneb updated this revision to Diff 52935.
etienneb added a comment.
nit
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.h
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.
LG with one nit.
Comment at: clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp:70
@@ +69,3 @@
+diag(SL->getLocStart(), "suspicious embedded NUL character");
+
etienneb updated this revision to Diff 52930.
etienneb marked 3 inline comments as done.
etienneb added a comment.
fix doc.
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
clang
alexfh requested changes to this revision.
This revision now requires changes to proceed.
Comment at: docs/clang-tidy/checks/misc-string-literal-with-embedded-nul.rst:6
@@ +5,3 @@
+
+Find occurences of string literal with embedded NUL character and validate
+their usage.
-
etienneb updated this revision to Diff 52927.
etienneb added a comment.
nit
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.h
etienneb updated this revision to Diff 52926.
etienneb marked 2 inline comments as done.
etienneb added a comment.
Revert last diff (invalid patchset).
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWith
alexfh added a comment.
Wait, it looks like you've updated the patch from an incorrect branch: I see
only clang-tidy/misc/MisplacedWideningCastCheck.cpp file here.
http://reviews.llvm.org/D18783
___
cfe-commits mailing list
cfe-commits@lists.llvm.o
alexfh added a comment.
A couple of nits.
Comment at: clang-tidy/misc/MisplacedWideningCastCheck.cpp:64
@@ -62,5 +63,3 @@
unsigned RHSWidth = getMaxCalculationWidth(Context, Bop->getRHS());
-if (Bop->getOpcode() == BO_Mul)
- return LHSWidth + RHSWidth;
-if (Bop
etienneb updated this revision to Diff 52856.
etienneb added a comment.
rebased.
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/MisplacedWideningCastCheck.cpp
Index: clang-tidy/misc/MisplacedWideningCastCheck.cpp
===
---
etienneb added a comment.
In http://reviews.llvm.org/D18783#393367, @LegalizeAdulthood wrote:
> There are some APIs where a series of strings are passed as a single `char *`
> with NUL separators between the strings and the last string is indicated by
> two NUL characters in a row. For instanc
LegalizeAdulthood added a subscriber: LegalizeAdulthood.
LegalizeAdulthood added a comment.
There are some APIs where a series of strings are passed as a single `char *`
with NUL separators between the strings and the last string is indicated by two
NUL characters in a row. For instance, see th
etienneb added a comment.
I finally get rid of the GetCharAt function.
Comment at: clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp:22
@@ +21,3 @@
+static unsigned int GetCharAt(const StringLiteral *SL, size_t offset) {
+ if (offset >= SL->getLength()) return 0;
+ return
etienneb updated this revision to Diff 52793.
etienneb added a comment.
nits.
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.h
etienneb updated this revision to Diff 52791.
etienneb marked 2 inline comments as done.
etienneb added a comment.
alexfh comments.
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
alexfh added a comment.
A couple of nits for now. Will take a closer look later.
Comment at: clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp:22
@@ +21,3 @@
+static unsigned int GetCharAt(const StringLiteral *SL, size_t offset) {
+ if (offset >= SL->getLength()) return 0;
On Tue, Apr 05, 2016 at 05:27:45PM +, Ben Craig via cfe-commits wrote:
> bcraig added a subscriber: bcraig.
> bcraig added a comment.
>
> Is this checker able to connect a std::string with a pre-declared string
> literal (i.e. constant propagation)? For example...
>
> const char *bad_char
etienneb added a comment.
In http://reviews.llvm.org/D18783#392486, @bcraig wrote:
> Is this checker able to connect a std::string with a pre-declared string
> literal (i.e. constant propagation)? For example...
>
> const char *bad_chars = "\0\1\2\3";
> std::string bad_str = bad_chars;
>
bcraig added a subscriber: bcraig.
bcraig added a comment.
Is this checker able to connect a std::string with a pre-declared string
literal (i.e. constant propagation)? For example...
const char *bad_chars = "\0\1\2\3";
std::string bad_str = bad_chars;
I've had real code make that mistake
etienneb updated this revision to Diff 52710.
etienneb added a comment.
alpha ordering
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
clang-tidy/misc/StringLiteralWithEmbeddedN
Eugene.Zelenko added inline comments.
Comment at: docs/ReleaseNotes.rst:161
@@ -156,1 +160,3 @@
+ truncation or invalid character escaping.
+
Fixed bugs:
I think will be good idea to sort check alphabetically. At least I did so :-)
http://reviews.llvm.org/D187
etienneb updated this revision to Diff 52708.
etienneb added a comment.
add missing reference in release-notes.
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
clang-tidy/misc/S
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.
Please mention this check in docs/ReleaseNotes.rst.
http://reviews.llvm.org/D18783
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-b
etienneb updated this revision to Diff 52707.
etienneb marked an inline comment as done.
etienneb added a comment.
fix comments.
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
bkramer added a subscriber: bkramer.
Comment at: clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp:21
@@ +20,3 @@
+// Retrieve the character at offset |offset| of the string literal |SL|.
+static unsigned int GetCharAt(const StringLiteral *SL, size_t offset) {
+ if (offset >=
etienneb updated this revision to Diff 52653.
etienneb added a comment.
Fix list.rst (bad merge)
http://reviews.llvm.org/D18783
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp
clang-tidy/misc/StringLiteralWit
etienneb created this revision.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.
This patch add the support for detecting suspicious string
literals and their usage.
The following example shows a incorrect character escaping leading
to an embedded NUL character.
```
26 matches
Mail list logo