CudaMallocPitch and CudaMemcpy2D/cudaMalloc

Hi,
I am new to Cuda Programming.
I am trying to allocate memory for image size 1366x768 using CudaMallocPitch and transferring data to Device using cudaMemcpy2D/ cudaMalloc . But it is giving me segmentation fault.

When I tried to do same with image size 640x480, its running perfectly.

Can anyone please tell me reason for that.

Thanks,
Tushar

Hard to say without code.
Most likely an alignment issue in your code resulting in an out of bounds memory access.
E.g. 1366 is not a multiple of 4 but 640 is.