diff --git a/compiler-rt/test/dfsan/sscanf.c b/compiler-rt/test/dfsan/sscanf.c new file mode 100644 index 0000000000000..dbc2de4ba96c1 --- /dev/null +++ b/compiler-rt/test/dfsan/sscanf.c @@ -0,0 +1,19 @@ +// RUN: %clang_dfsan %s -o %t && %run %t +// XFAIL: * + +#include +#include + +int main(int argc, char *argv[]) { + char buf[256] = "10000000000-100000000000 rw-p 00000000 00:00 0"; + long rss = 0; + // This test exposes a bug in DFSan's sscanf, that leads to flakiness + // in release_shadow_space.c (see + // https://github.com/llvm/llvm-project/issues/91287) + if (sscanf(buf, "Garbage text before, %ld, Garbage text after", &rss) == 1) { + printf("Error: matched %ld\n", rss); + return 1; + } + + return 0; +}