From ad3273be3cd7dd465d38d43aedbf069f7770bb92 Mon Sep 17 00:00:00 2001
From: Jordan Rose
+ (Difficulty: Easy, ongoing)
+ + +
Currently, the analyzer treats all floating-point values as unknown. + However, we already have most of the infrastructure we need to handle + floats: RangeConstraintManager. This would involve adding a new SVal kind + for constant floats, generalizing the constraint manager to handle floats + and integers equally, and auditing existing code to make sure it doesn't + make untoward assumptions. + (Difficulty: Medium)
Symbolic expressions of the form $sym & CONSTANT
can range from 0 to CONSTANT-
1 if CONSTANT is 2^n-1
, e.g. 0xFF (0b11111111), 0x7F (0b01111111), 0x3 (0b0011), 0xFFFF, etc. Even without handling general bitwise operations on symbols, we can at least bound the value of the resulting expression. Bonus points for handling masks followed by shifts, e.g. ($sym & 0b1100) >> 2
.
+ (Difficulty: Easy)
SIZE_MAX/4
characters.Though most of CStringChecker's functionality is disabled (due to poor diagnostics for error edge cases), it's still used to model certain operations like strlen
, which should give the same result each time it's called on a string. However, assuming that the string length is an arbitrary symbolic value can give strange results -- for example, strlen(str)+1
could wrap around to 0. (This is the root cause of PR16558.) In practice, strings are never that long, so picking some large upper bound and recording that in the state would make plenty of sense, and would fix these false positives.
+ (Difficulty: Easy)
(Difficulty: Easy)
Name, Description | Example | Progress |
valist.Uninitialized +Calls to the va_arg , va_copy , or
+va_end macro must happen after calling va_start and
+before calling va_end .
+ | +#include <stdarg.h> + +void test(int x, ...) { + va_list args; + int y = va_arg(args, int); // warn + va_start(args, x); + va_end(args, x); + int z = va_arg(args, int); // warn +} + | PR16811 |
valist.Unterminated +Every va_start must be matched by a va_end . A va_list
+can only be ended once.
+
+This should be folded into the generalized "ownership checker" described on the Open Projects page.
+ | +#include <stdarg.h> + +void test(int x, ...) { + va_list args; + va_start(args, x); + int y = x + va_arg(args, int); + // missing va_end +} + | PR16812 |