Closed lehni closed 3 years ago
Hi
Thanks for reporting. I‘m currently on vacation. I‘ll check this out as soon as I‘m back.
This was a tricky bug. But I think I solved the riddle.
My code failed at two stages:
1: When checking for characters that are not in the alphabet, the module used the global flag and thus was incrementing the lastIndex
of the RegExp-object. When tow words with "unknown" characters are hyphenated and the second word is shorter than the first word, the RegExp searches beyond the end of the word and doesn't recognize the second word as not hyphenatable by the patterns.
2: The WebAssembly-hyphenate function should return 0
, when a word containing a "unknown" character is passed to it. There was a bug that has been solved (see issue #165) but has not been rolled out, yet.
I'll fix this and make a new release. Thanks again for reporting.
That's great to hear, thank you @mnater !
I've created a simple test-case that reproduces the problem:
https://github.com/lehni/hyphenopoly-crash
When I run this simple program, I get an instant crash:
Output:
I've tested both with Node v14 and v16, same result.