A random observation: the segmentation fault happens after outputting 4096 bytes to the test log. It may be related to stdio buffering and thus it may never appear with line buffered output.