I suspect it is probably overflowing int max somewhere along the line, some googling shows this is also a buffer size for system calls such as read.