================
@@ -443,3 +443,33 @@ void test_unaligned_start_read(void) {
     fclose(fp);
   }
 }
+
+void no_crash_if_count_is_negative(long s, unsigned char *buffer) {
+  FILE *fp = fopen("path", "r");
+  if (fp) {
+    if (s * s == -1) {
----------------
NagyDonat wrote:

Nitpick: $s^2 = -1$ is mathematically impossible (even if we allow overflows: 
`0xffff...f` $= (4^{k})^2 - 1$  where $k$ is the number of `f` digits and two 
consecutive integers that are >1 cannot be both perfect squares). I know that 
the static analyzer doesn't know this and will happily assume that `s * s == 
-1` -- but it would be still nicer to use a different example.

https://github.com/llvm/llvm-project/pull/108393
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to