Skip to content

Commit

Permalink
BUGFIX: kdtree.cpp implementation of kd_res_item3 checks dereferenced…
Browse files Browse the repository at this point in the history
… value rather than pointer address
  • Loading branch information
paullric committed Nov 11, 2020
1 parent 80ff827 commit 4caa80d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/base/kdtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ void *kd_res_itemf(struct kdres *rset, float *pos)
void *kd_res_item3(struct kdres *rset, double *x, double *y, double *z)
{
if(rset->riter) {
if(*x) *x = rset->riter->item->pos[0];
if(*y) *y = rset->riter->item->pos[1];
if(*z) *z = rset->riter->item->pos[2];
if(x) *x = rset->riter->item->pos[0];
if(y) *y = rset->riter->item->pos[1];
if(z) *z = rset->riter->item->pos[2];
return rset->riter->item->data;
}
return 0;
Expand All @@ -674,9 +674,9 @@ void *kd_res_item3(struct kdres *rset, double *x, double *y, double *z)
void *kd_res_item3f(struct kdres *rset, float *x, float *y, float *z)
{
if(rset->riter) {
if(*x) *x = rset->riter->item->pos[0];
if(*y) *y = rset->riter->item->pos[1];
if(*z) *z = rset->riter->item->pos[2];
if(x) *x = rset->riter->item->pos[0];
if(y) *y = rset->riter->item->pos[1];
if(z) *z = rset->riter->item->pos[2];
return rset->riter->item->data;
}
return 0;
Expand Down

0 comments on commit 4caa80d

Please # to comment.