I get a segfault from this line of code:
int fatblob[1820][286][5];
Why is that?
int fatblob[1820][286][5];
you are trying to allocate a memory location of 180*286*5*4 (let size of int = 4) that is around 9.8 MB, so there is a possibility of having lesser default stack size on your OS.
LINUX has 8192 KB(i.e. 8 MB) of stack size. So obviously you will be getting a stack overflow if you are trying to allocate more memory on stack.
You can try changing the stack size of your OS. In LINUX you can try ulimit
ulimit -s < whateversize you want it to be>
like
$ ulimit -s 1024
I hope it will help you.