← Back to index
|
Original Bugzilla link
Bug 17314 – BinaryHeap crashes upon insertion if heapified with an array of length 1
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-04-09T12:42:41Z
Last change time
2018-01-05T13:28:16Z
Assigned to
No Owner
Creator
kirsybuu
Comments
Comment #0
by kirsybuu — 2017-04-09T12:42:41Z
Bug report for:
https://forum.dlang.org/post/
[email protected]
This code throws a Range violation: import std.stdio, std.container; void main() { auto pq = heapify([5]); pq.insert(8); } because the insert method fails to increases length in the case of length == 1: static if (isDynamicArray!Store) { if (_store.length == 0) _store.length = 8; else if (length == _store.length) _store.length = length * 3 / 2; // problem: 1 * 3 / 2 = 3 / 2 = 1 _store[_length] = value; // out-of-bounds! }
Comment #1
by github-bugzilla — 2017-04-11T20:14:01Z
Commits pushed to master at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/0912b243026e733db3b18c2c650d1809e5cb52dc
fix issue 17314
https://github.com/dlang/phobos/commit/ef9f4b9fee9277dfb0ad049a1806579eeaaa2042
fix issue 17314
https://github.com/dlang/phobos/commit/3b5ab7bec230b0d15d4fbd233323997291039040
Merge pull request #5329 from kirsybuu/issue_17314 Fix Issue 17314 - BinaryHeap crashes upon insertion if heapified with an array of length 1 merged-on-behalf-of: Steven Schveighoffer <
[email protected]
>
Comment #2
by github-bugzilla — 2017-06-17T11:34:29Z
Commits pushed to stable at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/0912b243026e733db3b18c2c650d1809e5cb52dc
fix issue 17314
https://github.com/dlang/phobos/commit/ef9f4b9fee9277dfb0ad049a1806579eeaaa2042
fix issue 17314
https://github.com/dlang/phobos/commit/3b5ab7bec230b0d15d4fbd233323997291039040
Merge pull request #5329 from kirsybuu/issue_17314
Comment #3
by github-bugzilla — 2018-01-05T13:28:16Z
Commits pushed to dmd-cxx at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/0912b243026e733db3b18c2c650d1809e5cb52dc
fix issue 17314
https://github.com/dlang/phobos/commit/ef9f4b9fee9277dfb0ad049a1806579eeaaa2042
fix issue 17314
https://github.com/dlang/phobos/commit/3b5ab7bec230b0d15d4fbd233323997291039040
Merge pull request #5329 from kirsybuu/issue_17314