I'm receiving this error in my output file:

Can't allocate -1124073472 bytes for image data

How do I change this code to rectify the problem?

unsigned char *thebuffer = 0;
thebuffer = malloc(2000000000);

To effectively answer my question...If any other information/code is needed, then let me know. Thanks