[PATCH] D18296: [Sema] Handle UTF-8 invalid format string specifiers
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 28 18:06:41 PDT 2016
rsmith accepted this revision.
This revision is now accepted and ready to land.
================
Comment at: lib/Analysis/FormatString.cpp:276
@@ +275,3 @@
+ // UTF-8 sequence. If that's the case, adjust the length accordingly.
+ if (llvm::sys::locale::isPrint(FirstByte))
+ return false;
----------------
How about using `getNumBytesForUTF8(FirstByte) != 1` here?
================
Comment at: lib/Analysis/FormatString.cpp:278
@@ +277,3 @@
+ return false;
+ if (!isLegalUTF8String(&SB, SE))
+ return false;
----------------
Perhaps only check `&SB, &SB + Len` -- it doesn't seem problematic if there's some non-UTF8 data after the specifier.
http://reviews.llvm.org/D18296
More information about the cfe-commits
mailing list