fontforge/fontforge — pull request #1759 by tshinnic (2014-10-01 05:21:05+00:00)
Title: Python script crash on 'empty' contour/layer/glyph/tuple

While investigating issue #1750 and trying to test scenarios with scripts, I found vulnerabilities when certain Python scripting APIs were called with empty ('new') FF objects. Internal routines would return NULL pointers in consequence of the empty objects but sometimes calling code would not guard against these, and following calls in code would crash trying to use the NULL pointers.

This change fixes the following scenarios:
```
contour1 = fontforge.contour()
contour1.is_quadratic = 1

contour1 = fontforge.contour()
contour1.spiros()

layerEmpty1 = fontforge.layer()
layerEmpty2 = fontforge.layer()
layerEmpty1.stroke("polygonal", layerEmpty2)
```
The last example pattern is seen for all three of `contour`, `layer`, and `glyph`.

All these combinations (and many others) were tested and no longer crash, or were proven not to crash originally.

Additionally, another crashing scenario with an empty tuple was found:
```
contour1 = fontforge.contour()
contour1.spiros = ()
```
This change fixes that problem by simply checking for an empty tuple.