Radovan =?utf-8?q?Božić?= <[email protected]>,
Radovan =?utf-8?q?Božić?= <[email protected]>,
Radovan =?utf-8?q?Božić?= <[email protected]>,
Radovan =?utf-8?q?Božić?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>


================
@@ -120,6 +126,16 @@ void call_bcopy_bzero(void) {
   __builtin_bzero(dst, 11); // expected-warning {{'bzero' will always 
overflow; destination buffer has size 10, but size argument is 11}}
 }
 
+void call_fread_fwrite_fgets(FILE *fp) {
+  char src[4];
+  fread(src, 2, 3, fp); // expected-warning {{'fread' will always overflow; 
destination buffer has size 4, but size argument is 6}}
----------------
nickdesaulniers wrote:

Consider adding cases which should not trigger the warning to ensure we don't 
have false positive diagnostics emitted.

fread(src, 2, 2, fp);
fread(src, 0, 10, fp);
fwrite(src, 2, 2, fp);
fgets(src, 4, fp);
fgets(src, 0, fp);

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

Reply via email to