Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtree_search() result is not checked in MemtxRTree::initIterator() #2052

Closed
rtsisyk opened this issue Jan 31, 2017 · 1 comment
Closed

rtree_search() result is not checked in MemtxRTree::initIterator() #2052

rtsisyk opened this issue Jan 31, 2017 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rtsisyk
Copy link
Contributor

rtsisyk commented Jan 31, 2017

rtree_search() result is not checked in MemtxRTree::initIterator():

void
252MemtxRTree::initIterator(struct iterator *iterator, enum iterator_type type,
253                         const char *key, uint32_t part_count) const
254{

 [CUT]

292        case ITER_NEIGHBOR:
293                op = SOP_NEIGHBOR;
294                break;
295        default:
296                return Index::initIterator(iterator, type, key, part_count);
297        }
   CID 1398676 (#1 of 1): Unchecked return value (CHECKED_RETURN)6. check_return: Calling rtree_search without checking return value (as is done elsewhere 28 out of 31 times).
298        rtree_search(&m_tree, &rect, op, &it->impl);

rtree_remove() result is not checked in test/unit/rtree_multidim.cc:

484template<unsigned DIMENSION>
485static void
486rand_test()
487{

[CUT]

509                if (insert) {
510                        CBox<DIMENSION> box;
511                        box.Randomize();
512                        size_t id = set.AddBox(box);
513                        struct rtree_rect rt;
514                        box.FillRTreeRect(&rt);
515                        rtree_insert(&tree, &rt, (void *)(id + 1));
   6. Falling through to end of if statement.
   13. Falling through to end of if statement.
516                } else {
517                        size_t id = set.RandUsedID();
518                        struct rtree_rect rt;
519                        set.entries[id].box.FillRTreeRect(&rt);
   CID 1398672 (#5-1 of 5): Unchecked return value (CHECKED_RETURN)21. check_return: Calling rtree_remove without checking return value (as is done elsewhere 6 out of 7 times).
520                        rtree_remove(&tree, &rt, (void *)(id + 1));
521                        set.DeleteBox(id);
522                }
@rtsisyk rtsisyk added the bug Something isn't working label Jan 31, 2017
@rtsisyk rtsisyk changed the title rtree_search() result is not chacked in MemtxRTree::initIterator() rtree_search() result is not checked in MemtxRTree::initIterator() Jan 31, 2017
@kostja kostja added this to the 1.7.6 milestone Mar 29, 2017
@rtsisyk rtsisyk modified the milestones: 1.7.6, 1.7.7 Oct 21, 2017
@kostja kostja assigned rtokarev and rtsisyk and unassigned alyapunov Oct 27, 2017
@Gerold103 Gerold103 assigned Gerold103 and unassigned rtsisyk Feb 9, 2018
@kostja kostja modified the milestones: 2.1.1, 1.9.0, wishlist Feb 11, 2018
@PersDep PersDep self-assigned this Aug 20, 2020
PersDep added a commit that referenced this issue Sep 1, 2020
rtree_search() has return value and it is ignored in some cases.
Although it is totally fine it seems to be reasonable to comment those
cases as far as such usage might be questionable.

Closes #2052
@PersDep
Copy link
Contributor

PersDep commented Sep 1, 2020

Well, right, now there are rtree_search() usages in memtx_rtree_index_create_iterator() in memtx_rtree.c and in iterator_invalidate_check() in rtree_iterator.cc but it is not a problem as far as iterator is initialized correctly anyway. There is nothing we need to do here.

@kyukhin kyukhin modified the milestones: wishlist, 1.10.8 Sep 8, 2020
kyukhin pushed a commit that referenced this issue Sep 8, 2020
rtree_search() has return value and it is ignored in some cases.
Although it is totally fine it seems to be reasonable to comment those
cases as far as such usage might be questionable.

Closes #2052

(cherry picked from commit 4883f19)
kyukhin pushed a commit that referenced this issue Sep 8, 2020
rtree_search() has return value and it is ignored in some cases.
Although it is totally fine it seems to be reasonable to comment those
cases as far as such usage might be questionable.

Closes #2052

(cherry picked from commit 4883f19)
kyukhin pushed a commit that referenced this issue Sep 8, 2020
rtree_search() has return value and it is ignored in some cases.
Although it is totally fine it seems to be reasonable to comment those
cases as far as such usage might be questionable.

Closes #2052

(cherry picked from commit 4883f19)
@kyukhin kyukhin closed this as completed in 4883f19 Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants