about summary refs log tree commit diff homepage
path: root/test/Runtime
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2018-09-03 20:49:50 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-09-06 11:19:12 +0100
commit21380e5201f235a5f9ee9676785d08d39743aa4e (patch)
treebdef9e288514ca5b7611a3cdffbe8c0e823ab4ff /test/Runtime
parent21c5a5a52cfccdd8deec6add0dd24d4e5055aea4 (diff)
downloadklee-21380e5201f235a5f9ee9676785d08d39743aa4e.tar.gz
runtime: fix memory error in canonicalize_file_name
Fixes #46 and reverts #47. As stated in #46, the solution works for
musl, glibc etc. However, the code in stub.c is executed by uclibc
and uclibc doesn't allocate the target buffer in realpath. The
memory error occured while running df for 10min with DFS.
Diffstat (limited to 'test/Runtime')
-rw-r--r--test/Runtime/POSIX/CanonicalizeFileName.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Runtime/POSIX/CanonicalizeFileName.c b/test/Runtime/POSIX/CanonicalizeFileName.c
new file mode 100644
index 00000000..56b02327
--- /dev/null
+++ b/test/Runtime/POSIX/CanonicalizeFileName.c
@@ -0,0 +1,16 @@
+// REQUIRES: not-darwin
+// RUN: %llvmgcc %s -Wall -emit-llvm -g -O0 -c -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --exit-on-error %t.bc
+
+#define _GNU_SOURCE
+#include <limits.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(int argc, char * argv[]) {
+  char cwd[PATH_MAX] = {0};
+
+  if (!getcwd(cwd, PATH_MAX)) exit(EXIT_FAILURE);
+  if (!canonicalize_file_name(cwd)) exit(EXIT_FAILURE);
+}