summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-12-23 02:27:37 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-12-23 02:27:37 (GMT)
commit86f65d5dbb2543d5b30b6f9450994bebcbc5d53e (patch)
tree56fc8827c2ec064a341d757f7cf510ebed93d26a /Modules
parent70df8f8c6779d0ecfd364b895ee6a422bc7699c5 (diff)
downloadcpython-86f65d5dbb2543d5b30b6f9450994bebcbc5d53e.zip
cpython-86f65d5dbb2543d5b30b6f9450994bebcbc5d53e.tar.gz
cpython-86f65d5dbb2543d5b30b6f9450994bebcbc5d53e.tar.bz2
Issue #10254: Fixed a crash and a regression introduced by the implementation of PRI 29.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/unicodedata.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 233f8e0..bd96e36 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -684,10 +684,14 @@ nfc_nfkc(PyObject *self, PyObject *input, int k)
comb = 0;
while (i1 < end) {
int comb1 = _getrecord_ex(*i1)->combining;
- if (comb && (comb1 == 0 || comb == comb1)) {
- /* Character is blocked. */
- i1++;
- continue;
+ if (comb) {
+ if (comb1 == 0)
+ break;
+ if (comb >= comb1) {
+ /* Character is blocked. */
+ i1++;
+ continue;
+ }
}
l = find_nfc_index(self, nfc_last, *i1);
/* *i1 cannot be combined with *i. If *i1
@@ -711,6 +715,7 @@ nfc_nfkc(PyObject *self, PyObject *input, int k)
/* Replace the original character. */
*i = code;
/* Mark the second character unused. */
+ assert(cskipped < 20);
skipped[cskipped++] = i1;
i1++;
f = find_nfc_index(self, nfc_first, *i);