fontforge/fontforge — pull request #1407 by blipvert (2014-06-11 15:23:45+00:00)
Title: Fixed crashes caused by failure to handle Unicode surrogates when converting to UTF

Code points in Unicode range U+D800–U+DFFF are officially unassigned and unnamed as they are used by UTF-16 to encode outside the Basic Multilingual Plane. In practice, they function much like Private Use regions with regards to glyph naming and representation, and FontForge does not disallow them from being defined (nor should it). However, `utf8_idp` will fail and return `NULL` if it encounters one of these characters (which is technically correct behavior), and there is code which will crash in this case, because it checks only for private use characters and not surrogates. I have addressed this by defining a macro `issurrogate` as a counterpart to `isprivateuse` which should be called in most cases where `isprivateuse` is called. This fixes the crashing.