]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Abort if a dir is given to --suppressions. Fixes bug 197456.
authorNicholas Nethercote <njn@valgrind.org>
Wed, 24 Jun 2009 03:49:19 +0000 (03:49 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 24 Jun 2009 03:49:19 +0000 (03:49 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10366

coregrind/m_errormgr.c
memcheck/tests/Makefile.am
memcheck/tests/supp-dir.stderr.exp [new file with mode: 0644]
memcheck/tests/supp-dir.vgtest [new file with mode: 0644]

index 14bdd7f1a5b7d4ad679e3fd7669f5a028e924cb8..a5ef3c805566835697355a8b6bedd0a17bee3a9b 100644 (file)
@@ -952,6 +952,15 @@ static void load_one_suppressions_file ( Char* filename )
    Char*  err_str = NULL;
    SuppLoc tmp_callers[VG_MAX_SUPP_CALLERS];
 
+   // Check it's not a directory.
+   if (VG_(is_dir)( filename )) {
+      if (VG_(clo_xml))
+         VG_UMSG("</valgrindoutput>\n");
+      VG_UMSG("FATAL: suppressions file \"%s\" is a directory", filename );
+      VG_(exit)(1);
+   }
+
+   // Open the suppression file.
    sres = VG_(open)( filename, VKI_O_RDONLY, 0 );
    if (sr_isError(sres)) {
       if (VG_(clo_xml))
index ee32dd8654f4939644bf3e2dbdbae3cb5b712023..ab4ae0b824a963dc5fcee2a59ba5a41c99153404 100644 (file)
@@ -149,6 +149,7 @@ EXTRA_DIST = \
        strchr.stderr.exp strchr.stderr.exp2 strchr.stderr.exp-darwin \
            strchr.vgtest \
        str_tester.stderr.exp str_tester.vgtest \
+       supp-dir.vgtest supp-dir.stderr.exp \
        supp_unknown.stderr.exp supp_unknown.vgtest supp_unknown.supp \
        supp1.stderr.exp supp1.vgtest \
        supp2.stderr.exp supp2.vgtest \
diff --git a/memcheck/tests/supp-dir.stderr.exp b/memcheck/tests/supp-dir.stderr.exp
new file mode 100644 (file)
index 0000000..02b0659
--- /dev/null
@@ -0,0 +1,2 @@
+
+FATAL: suppressions file "x86/" is a directory
diff --git a/memcheck/tests/supp-dir.vgtest b/memcheck/tests/supp-dir.vgtest
new file mode 100644 (file)
index 0000000..f3e9dc3
--- /dev/null
@@ -0,0 +1,2 @@
+prog: ../../tests/true
+vgopts: --suppressions=x86/