aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanataka Shinya <hanataka.shinya@gmail.com>2021-02-17 23:00:48 -0500
committerCarlos O'Donell <carlos@redhat.com>2021-04-26 08:03:32 -0400
commit82292c99b2b68504e0b09b19a339d0232c2e1eaa (patch)
treeaa4686718390432ccc5dd1eace538d6b10771aa8
parent7f3e7c262cab4e2401e4331a6ef29c428de02044 (diff)
downloadglibc-82292c99b2b68504e0b09b19a339d0232c2e1eaa.tar
glibc-82292c99b2b68504e0b09b19a339d0232c2e1eaa.tar.gz
glibc-82292c99b2b68504e0b09b19a339d0232c2e1eaa.tar.bz2
glibc-82292c99b2b68504e0b09b19a339d0232c2e1eaa.zip
LC_COLLATE: Fix last character ellipsis handling (Bug 22668)
During ellipsis processing the collation cursor was not correctly moved to the end of the ellipsis after processing. The code inserted the new entry after the cursor, but before the real end of the ellipsis: [cursor] ... element_t <-> element_t <-> element_t <-> element_t "<U0000>" "<U0001>" "<U007F>" startp endp At the end of the function we have: [cursor] ... element_t <-> element_t <-> element_t "<U007E>" "<U007F>" endp The cursor should be pointing at endp, the last element in the doubly-linked list, otherwise when execution returns to the caller we will start inserting the next line after <U007E>. Subsequent operations end up unlinking the ellipsis end entry or just leaving it in the list dangling from the end. This kind of dangling is immediately visible in C.UTF-8 with the following sorting from strcoll: <U0010FFFF> <U0000FFFF> <U000007FF> <U0000007F> With the cursor correctly adjusted the end entry is correctly given the right location and thus the right weight. Retested and no regressions on x86_64 and i686. Co-authored-by: Carlos O'Donell <carlos@redhat.com>
-rw-r--r--locale/programs/ld-collate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 0af21e05e2..b6406b775d 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1483,6 +1483,9 @@ order for `%.*s' already defined at %s:%Zu"),
}
}
}
+ /* Move the cursor to the last entry in the ellipsis.
+ Subsequent operations need to start from the last entry. */
+ collate->cursor = endp;
}