diff options
author | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-06-24 03:49:19 +0000 |
---|---|---|
committer | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-06-24 03:49:19 +0000 |
commit | cc37d2eea056805a5033e608dd557be84fadcd16 (patch) | |
tree | afc02c798ca09a08c9edcfc3f34eace4c1609cee | |
parent | 8b68b64759254d514d98328c496cbd88cde4c9a5 (diff) | |
download | valgrind-cc37d2eea056805a5033e608dd557be84fadcd16.tar.gz |
Abort if a dir is given to --suppressions. Fixes bug 197456.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10366 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r-- | coregrind/m_errormgr.c | 9 | ||||
-rw-r--r-- | memcheck/tests/Makefile.am | 1 | ||||
-rw-r--r-- | memcheck/tests/supp-dir.stderr.exp | 2 | ||||
-rw-r--r-- | memcheck/tests/supp-dir.vgtest | 2 |
4 files changed, 14 insertions, 0 deletions
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index 14bdd7f1a..a5ef3c805 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -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)) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index ee32dd865..ab4ae0b82 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -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 index 000000000..02b065995 --- /dev/null +++ b/memcheck/tests/supp-dir.stderr.exp @@ -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 index 000000000..f3e9dc394 --- /dev/null +++ b/memcheck/tests/supp-dir.vgtest @@ -0,0 +1,2 @@ +prog: ../../tests/true +vgopts: --suppressions=x86/ |