I hit this crash on Mac OS X while processing a file with 1 MB in
only one line.
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000100456000
0x00007fff82eb4337 in memmove$VARIANT$sse3x ()
#0 0x00007fff82eb4337 in memmove$VARIANT$sse3x ()
#1 0x00007fff82f2fe97 in fgets ()
#2 0x000000010000135d in convert (input_file=0x1001039a0
output_file=0x1001000e0 "n.html", config_file=0x1001023f0 "zht2zhs.ini")
#3 0x000000010000176e in main (argc=7, argv=0x7fff5fbff920) at
The solution I found is to avoid using the fragile fgets() and
memory reallocation and replace it with simple fread() and fseek().