Bug report for: https://forum.dlang.org/post/cavtukhpddgoilredilk@forum.dlang.org 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! }
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 <schveiguy@users.noreply.github.com>
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
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