]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Don't silently ignore any suppression contexts beyond the 4th -- instead abort
authorNicholas Nethercote <n.nethercote@gmail.com>
Mon, 8 Nov 2004 13:31:29 +0000 (13:31 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Mon, 8 Nov 2004 13:31:29 +0000 (13:31 +0000)
with a warning.  Addresses part of bug #77922.

MERGED FROM HEAD

git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_2_2_0_BRANCH@2947

coregrind/vg_errcontext.c

index 0e08175003a6be06b70c3e248848b61d495d6c42..07d4c8f97508b2920c1be59403e937068e0d33df 100644 (file)
@@ -786,7 +786,7 @@ static void load_one_suppressions_file ( Char* filename )
 {
 #  define N_BUF 200
    Int   fd, i;
-   Bool  eof;
+   Bool  eof, too_many_contexts = False;
    Char  buf[N_BUF+1];
    Char* tool_names;
    Char* supp_name;
@@ -882,9 +882,13 @@ static void load_one_suppressions_file ( Char* filename )
       /* make sure to grab the '}' if the num callers is >=
          VG_N_SUPP_CALLERS */
       if (!VG_STREQ(buf, "}")) {
-         do {
-           eof = VG_(get_line) ( fd, buf, N_BUF );
-        } while (!eof && !VG_STREQ(buf, "}"));
+         // Don't just ignore extra lines -- abort.  (Someone complained
+         // about silent ignoring of lines in bug #77922.)
+         //do {
+         //   eof = VG_(get_line) ( fd, buf, N_BUF );
+         //} while (!eof && !VG_STREQ(buf, "}"));
+         too_many_contexts = True;
+         goto syntax_error;
       }
 
       supp->next = vg_suppressions;
@@ -898,6 +902,13 @@ static void load_one_suppressions_file ( Char* filename )
       VG_(message)(Vg_UserMsg, 
                    "FATAL: in suppressions file `%s': unexpected EOF", 
                    filename );
+   } else if (too_many_contexts) {
+      VG_(message)(Vg_UserMsg, 
+                   "FATAL: in suppressions file: `%s': at %s:", 
+                   filename, buf );
+      VG_(message)(Vg_UserMsg, 
+                   "too many lines (limit of %d contexts in suppressions)",
+                   VG_N_SUPP_CALLERS);
    } else {
       VG_(message)(Vg_UserMsg, 
                    "FATAL: in suppressions file: `%s': syntax error on: %s", 
@@ -905,7 +916,7 @@ static void load_one_suppressions_file ( Char* filename )
    }
    VG_(close)(fd);
    VG_(message)(Vg_UserMsg, "exiting now.");
-    VG_(exit)(1);
+   VG_(exit)(1);
 
 #  undef N_BUF   
 }