summaryrefslogtreecommitdiffstats
path: root/intl/hyphenation/hyphen
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-05-15 21:37:22 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-05-15 21:37:22 +0200
commit41cbe2d931d2742bb8dd6240eae9599e3bf3a512 (patch)
tree5fbadeaa491e09d2e157661b97ac8815ead83f92 /intl/hyphenation/hyphen
parent0c994ed0963e1552b95708495d58ef193c48fc3c (diff)
downloadUXP-41cbe2d931d2742bb8dd6240eae9599e3bf3a512.tar
UXP-41cbe2d931d2742bb8dd6240eae9599e3bf3a512.tar.gz
UXP-41cbe2d931d2742bb8dd6240eae9599e3bf3a512.tar.lz
UXP-41cbe2d931d2742bb8dd6240eae9599e3bf3a512.tar.xz
UXP-41cbe2d931d2742bb8dd6240eae9599e3bf3a512.zip
Merge libhyphen fix from upstream.
Diffstat (limited to 'intl/hyphenation/hyphen')
-rw-r--r--intl/hyphenation/hyphen/hyphen.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/intl/hyphenation/hyphen/hyphen.c b/intl/hyphenation/hyphen/hyphen.c
index 9a132d026..9f2b7112c 100644
--- a/intl/hyphenation/hyphen/hyphen.c
+++ b/intl/hyphenation/hyphen/hyphen.c
@@ -438,11 +438,25 @@ for (k = 0; k < 2; k++) {
}
if (k == 0 || nextlevel) {
- while (fgets (buf, sizeof(buf), f) != NULL) {
+ while (fgets(buf, sizeof(buf), f) != NULL) {
+
+ /* discard lines that don't fit in buffer */
+ if (!feof(f) && strchr(buf, '\n') == NULL) {
+ int c;
+ while ((c = fgetc(f)) != '\n' && c != EOF);
+ /* issue warning if not a comment */
+ if (buf[0] != '%') {
+ fprintf(stderr, "Warning: skipping too long pattern (more than %lu chars)\n", sizeof(buf));
+ }
+ continue;
+ }
+
if (strncmp(buf, "NEXTLEVEL", 9) == 0) {
- nextlevel = 1;
- break;
- } else if (buf[0] != '%') hnj_hyphen_load_line(buf, dict[k], hashtab);
+ nextlevel = 1;
+ break;
+ } else if (buf[0] != '%') {
+ hnj_hyphen_load_line(buf, dict[k], hashtab);
+ }
}
} else if (k == 1) {
/* default first level: hyphen and ASCII apostrophe */