Skip to content

Commit

Permalink
bugfix: buffer overflow in case byte or short images are projected
Browse files Browse the repository at this point in the history
  • Loading branch information
haesleinhuepf committed Dec 11, 2019
1 parent bdc1d11 commit 8bb15df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/haesleinhuepf/clij/kernels/maxProjection.cl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ __kernel void max_project_3d_2d(

const int x = get_global_id(0);
const int y = get_global_id(1);
DTYPE_IN max = 0;
float max = 0;
for(int z = 0; z < GET_IMAGE_IN_DEPTH(src); z++)
{
DTYPE_IN value = READ_IMAGE_3D(src,sampler,(int4)(x,y,z,0)).x;
float value = READ_IMAGE_3D(src,sampler,(int4)(x,y,z,0)).x;
if (value > max || z == 0) {
max = value;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/haesleinhuepf/clij/kernels/projections.cl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ __kernel void mean_project_3d_2d(

const int x = get_global_id(0);
const int y = get_global_id(1);
DTYPE_IN sum = 0;
float sum = 0;
int count = 0;
for(int z = 0; z < GET_IMAGE_IN_DEPTH(src); z++)
{
Expand All @@ -27,10 +27,10 @@ __kernel void min_project_3d_2d(

const int x = get_global_id(0);
const int y = get_global_id(1);
DTYPE_IN min = 0;
float min = 0;
for(int z = 0; z < GET_IMAGE_IN_DEPTH(src); z++)
{
DTYPE_IN value = READ_IMAGE_3D(src,sampler,(int4)(x,y,z,0)).x;
float value = READ_IMAGE_3D(src,sampler,(int4)(x,y,z,0)).x;
if (value < min || z == 0) {
min = value;
}
Expand Down

0 comments on commit 8bb15df

Please sign in to comment.