fontforge/fontforge — pull request #1678 by tshinnic (2014-08-22 21:17:15+00:00)
Title: Fix crash on GPOS kern classes select class text field

`fontforgeexe/kernclass.c` :: `KCD_TextSelect()` had several problems handling text strings found in the "Select Class Containing:" incremental match text field. One could carefully tab into the field, but mouse clicking into the field would instantly crash.

Code initially scanning string was missing check for end-of-string, which was a problem when the field was empty. Code was not checking the return from `u2utf8_copyn()` which could return NULL on various errors. The two of these flaws caused the crash.

Additionally further in the code there was a duplicated check for end-of-string and then a missing check that could walk off the end of the string.

Tested as fixed against both such text fields and with various input and match strings.
```
Ubuntu-Medium.sfd
Element / Font Info... / Lookups / GPOS
"'kern' Horizontal Kerning lookup 1"
"'kern' Horizontal Kerning lookup 1 subtable"
clicked into text field "Select Class Containing:" under "First Char"
```