Hello,
To use spine-c runtime we are supposed to implement _spUtil_readFile. Function has to return proper length of the read buffer so I was under impression there was no need to zero-terminate it but today I found out there is.
JSON parser uses strtod for numbers (Json.c:107) and for some reason it sometimes crashes with strings that are not zero-terminated. Code was compiled in Visual C++ 2008 Express and ran under Windows XP (strangely I couldn't reproduce it Windows 8 and even on XP it was pretty rare). I couldn't figure out what exactly causes the crash but it happens when parsing first number in a JSON file after finishing parsing another non-zero-terminated JSON. Running application with Dr. Memory (memory debugging tool) produced warnings of uninitialized memory reads on that exact line.
I have tried changing _spUtil_readFile so it would return zero-terminated string with length including the zero but that breaks atlas creation (spAtlas_createFromFile returns NULL).
As a solution I have modified _spUtil_readFile to return a zero-terminated string and length excluding zero which is very non intuitive but seems to fix the problem (warnings from Dr. Memory also gone). Are you aware of this phenomenon?