================
@@ -255,3 +255,27 @@ void dontCrashForInvalidFormatString() {
   snprintf((char*)0, 0, "%");
   snprintf((char*)0, 0, "\0");
 }
+
+
+// Also warn about unsafe printf/scanf-like functions:
+void myprintf(const char *F, ...) __attribute__((__format__ (__printf__, 1, 
2)));
----------------
ojhunt wrote:

could we add a few tests where the format string isn't the first arg? and also 
something where the format string comes equal to and after the first arg index? 
(only as a "do something sane/don't crash" test, not because anyone should ever 
ever do this :D

https://github.com/llvm/llvm-project/pull/173096
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to