I've reproduced the bug on a personal test file (not attached, its a generic bug).
Basically the fault lies in the openSomeFile method which mistakenly keeps closing files, which means fseeko() was ultimately segfaulting because it was using a mish-mash of old and newly allocated FILE data (deep inside glibc).
Patch attached fixes that problem, and also two memory leaks as reported by valgrind.
I've reproduced the bug on a personal test file (not attached, its a generic bug).
Basically the fault lies in the openSomeFile method which mistakenly keeps closing files, which means fseeko() was ultimately segfaulting because it was using a mish-mash of old and newly allocated FILE data (deep inside glibc).
Patch attached fixes that problem, and also two memory leaks as reported by valgrind.