Guys, I have the following code to align memory of the stack:
// Allocate Memory of the Stack for the recursive call unsigned char buffer[cluster_size(file) + 16)]; unsigned char * cache; // Align Memory Allocation for recursive call cache = (unsigned char *)(((unsigned int)&buffer + 16) & ~0x0f); //alignment for 4 bytes
Can anyone see why this is causing issues. It works if I increase the allocation. Say to:
unsigned char buffer[cluster_size(file) + 512)];
EDITED: The error appears as though I over stepping the memory boundary.