From f3a4c6dcff945afe7a72975a9d995d6225b5f3cc Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 14 Feb 2002 00:26:58 +0000 Subject: [PATCH] (collate_finish): Bail out with a message if input is too confusion instead of using assert. (collate_read): Don't crash on unknown symbol. --- locale/programs/ld-collate.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 81fbade2bd9..b14bd584196 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -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) { -- 2.47.2