Given that the error is:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt
The first port of call would be to run a memory checker. This post has quite a lot of detail on how to do that.
memtest86 is by far the most popular amongst the memory checking crowd and works very well. It has a whole slew of tests that you pick and choose to run. The program was created in 1994 and was last updated in 2007, so it’s a bit old.
Prime95 is another memory checker, but one that has been updated more regularly and that works with multicore CPUs, which are becoming more prevalent these days. The program tests both the CPU and memory by using various stress tests, such as calculating large prime numbers.
The only other thing that springs to mind is that you're running out of memory and this is a misreported error. How much physical RAM do you have? What size is your swap file? And how big are the images you're manipulating?