Fix segfault related to huge files mapping

This patch resolves a bug handling heavy test cases.