I'm on OSX Yosemite. Using the default version of flex provided by Apple (2.5.35)
The problem is that your version of FlexLexer.h defines yy_n_chars as int (32 bits):
int yy_n_chars;
The system version defines it as size_t, which is 64 bits on Mac:
The two structure definitions have different sizes and member alignments. It appears when ScriptReader is compiled, it uses the mclinker version of the header. It allocates a member on the stack in readScript. It then calls into the constructor (in the generated file ScriptScanner.cpp), which seems to have included the system version of the header. The latter assumes a larger structure, writing past the size allocated on the stack for the structure and smashing the stack. It crashes in __stack_chk_fail on return from readScript.