]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(collate_finish): Bail out with a message if input is too confusion
authorUlrich Drepper <drepper@redhat.com>
Thu, 14 Feb 2002 00:26:58 +0000 (00:26 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 14 Feb 2002 00:26:58 +0000 (00:26 +0000)
instead of using assert.
(collate_read): Don't crash on unknown symbol.

locale/programs/ld-collate.c

index 81fbade2bd9a3c33dac152145510a460b826a3ff..b14bd5841968cb947b67b8409ffb6d704e203093 100644 (file)
@@ -1804,7 +1804,15 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
   sect = collate->sections;
   while (sect != NULL && sect->rules == NULL)
     sect = sect->next;
-  assert (sect != NULL);
+
+  /* Bail out if we have no sections because of earlier errors.  */
+  if (sect == NULL)
+    {
+      WITH_CUR_LOCALE (error (EXIT_FAILURE, 0,
+                             _("too many errors; giving up")));
+      return;
+    }
+
   ruleidx = 0;
   do
     {
@@ -3481,11 +3489,18 @@ error while adding equivalent collating symbol"));
              symstr = ucs4buf;
              symlen = 9;
            }
-         else
+         else if (arg != NULL)
            {
              symstr = arg->val.str.startmb;
              symlen = arg->val.str.lenmb;
            }
+         else
+           {
+             lr_error (ldfile, _("%s: bad symbol <%.*s>"), "LC_COLLATE",
+                       ldfile->token.val.str.lenmb,
+                       ldfile->token.val.str.startmb);
+             break;
+           }
 
          if (state == 0)
            {