diff options
author | Thomas White <taw@physics.org> | 2010-02-19 14:39:39 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-02-19 14:39:39 +0100 |
commit | bea7274dc2523829d4091ed79c7db6cba4d63bfb (patch) | |
tree | 2197be444a32cd90a7c02d3dfb650d7ba432dbea /src/diffraction-gpu.c | |
parent | 0d471a2f7722981b0d766d040a1c69424406f6b6 (diff) |
Don't overrun bounds of sfac buffer
This results in Bad Stuff happening.
Diffstat (limited to 'src/diffraction-gpu.c')
-rw-r--r-- | src/diffraction-gpu.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c index 2408538f..2c7b6884 100644 --- a/src/diffraction-gpu.c +++ b/src/diffraction-gpu.c @@ -216,9 +216,9 @@ void get_diffraction_gpu(struct image *image, int na, int nb, int nc, } /* Create a single-precision version of the scattering factors */ - sfac_size = IDIM*IDIM*sizeof(cl_float)*2; /* complex */ - sfac_ptr = malloc(IDIM*IDIM*sizeof(cl_float)*2); - for ( i=0; i<IDIM*IDIM; i++ ) { + sfac_size = IDIM*IDIM*IDIM*sizeof(cl_float)*2; /* complex */ + sfac_ptr = malloc(sfac_size); + for ( i=0; i<IDIM*IDIM*IDIM; i++ ) { sfac_ptr[2*i+0] = creal(image->molecule->reflections[i]); sfac_ptr[2*i+1] = cimag(image->molecule->reflections[i]); } |