possible fix for #128 (#129)
authorBenito van der Zander <benito@benibela.de>
Fri, 27 Apr 2018 12:06:14 +0000 (14:06 +0200)
committerSteven G. Johnson <stevenj@mit.edu>
Fri, 27 Apr 2018 12:06:14 +0000 (08:06 -0400)
Does this help? I do not really remember what I wrote back then

utf8proc.c

index 6961e4b10d3a200b3bde35223631004d692e4b56..c0f84d9702bfe7d71e1516afb150805e671819a7 100644 (file)
@@ -631,9 +631,9 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *b
             current_property->comb_index != UINT16_MAX &&
             current_property->comb_index >= 0x8000) {
           int sidx = starter_property->comb_index;
-          int idx = (current_property->comb_index & 0x3FFF) - utf8proc_combinations[sidx];
-          if (idx >= 0 && idx <= utf8proc_combinations[sidx + 1] ) {
-            idx += sidx + 2;
+          int idx = current_property->comb_index & 0x3FFF;
+          if (idx >= utf8proc_combinations[sidx] && idx <= utf8proc_combinations[sidx + 1] ) {
+            idx += sidx + 2 - utf8proc_combinations[sidx];
             if (current_property->comb_index & 0x4000) {
               composition = (utf8proc_combinations[idx] << 16) | utf8proc_combinations[idx+1];
             } else