Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSegfault on Nightly in BTreeSet and BTreeMap #33197
Comments
apasel422
added
A-collections
I-crash
labels
Apr 25, 2016
alexcrichton
referenced this issue
Apr 25, 2016
Closed
Tracking issue for sorted collection ranges #27787
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I was just looking at this briefly and I'm reminded the collection can not trust the user-supplied comparison functions (Ord) and thus the fix must be something more involved than comparing the input keys. |
This comment has been minimized.
This comment has been minimized.
|
So it seems we must first compare start to end (if start>end, stop). Then go forward but check for the end of the BTree. |
This comment has been minimized.
This comment has been minimized.
|
I see a few possible options here:
Ironically, the |
alexcrichton
added
P-medium
and removed
regression-from-stable-to-nightly
I-nominated
labels
Apr 27, 2016
This comment has been minimized.
This comment has been minimized.
Note that safety should never depend on well-behavedness of |
This comment has been minimized.
This comment has been minimized.
|
As a variant of @gereeter's second bullet point, the structural check can be done as a post-processing step in which we walk up the tree from both handles, keeping track of the path we take as we go (i.e. the index of the edges). Once we finish ascending, we compare the paths lexicographically, and return an empty This has the benefit of avoiding additional complexity in the descent code and iteration code, and is amenable to removal via specialization if we ever get an |
This comment has been minimized.
This comment has been minimized.
0x7CFE
commented
Jan 29, 2017
|
Reproduced on recent Just wanted to know, is there any progress regarding the issue? Looks like it's quite annoying bug because of it's cryptic nature. I spent quite a time trying to find why the program exits silently even without a panic message. Only debugger helped me to find the actual reason. Recently there were some changes in the range API. Are they affecting the issue in some way? |
This comment has been minimized.
This comment has been minimized.
|
Could you share the Ord implementation testcase that caused this? Last time I checked the old testcases for this didn't work. |
This comment has been minimized.
This comment has been minimized.
0x7CFE
commented
Jan 30, 2017
•
|
Unfortunately I don't have minimal reproducing impl, but I'm working on it. Last observations were that if I replace in my code I have rather complex keys ( Currently I'm not sure, whether it's due to |
This comment has been minimized.
This comment has been minimized.
0x7CFE
commented
Feb 5, 2017
|
Indeed, in my case crash occurs when broken boundary logic yields the range where lower bound is actually greater that the upper one (in terms of Please note that it's highly dependant on the actual in-memory structrure of the tree. In my case for this to happen btree should be filled to a certain point. |
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Feb 14, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Feb 14, 2017
bors
added a commit
that referenced
this issue
Feb 14, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Feb 15, 2017
bors
added a commit
that referenced
this issue
Feb 15, 2017
bors
added a commit
that referenced
this issue
Feb 15, 2017
bors
added a commit
that referenced
this issue
Feb 15, 2017
bors
added a commit
that referenced
this issue
Feb 15, 2017
This comment has been minimized.
This comment has been minimized.
|
This is fixed |
This comment has been minimized.
This comment has been minimized.
Manishearth
closed this
Feb 19, 2017
This comment has been minimized.
This comment has been minimized.
|
Thanks! |
potocpav commentedApr 25, 2016
An iterator created by
BTreeMap::range,BTreeMap::range_mutandBTreeSet::rangecan wander off of the underlying data and segfault. It is caused by supplying an upper bound that is lower than the lower bound and there is an element between them.Code to reproduce: http://is.gd/HoNWLH
tested also locally on
rustc 1.10.0-nightly (b5ba5923f 2016-04-21).The iterator ends when the iterated element equals to the upper bound: https://doc.rust-lang.org/src/collections/up/src/libcollections/btree/map.rs.html#898-908. If the upper bound is lower than the lower bound, this condition is never met. This is not checked for while creating the iterator in https://doc.rust-lang.org/src/collections/up/src/libcollections/btree/map.rs.html#464-588.