Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 06, 2021 [Issue 22359] joiner over an empty forward range object liable to segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22359 --- Comment #1 from Adam D. Ruppe <destructionator@gmail.com> --- There's also a static if (isBidirectional && hasNested!Result) _currentBack = typeof(_currentBack).init; Same problem. -- |
October 06, 2021 [Issue 22359] joiner over an empty forward range object liable to segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22359 --- Comment #2 from Adam D. Ruppe <destructionator@gmail.com> --- A patched function that can fix the issue: static if (isForwardRange!RoR && isForwardRange!(ElementType!RoR)) { @property auto save() { static if(is(typeof(null) : typeof(_current))) { auto r = Result(_items.save, _current is null ? null : _current.save); } else auto r = Result(_items.save, _current.save); static if (isBidirectional) { static if(is(typeof(null) : typeof(_currentBack))) { r._currentBack = _currentBack is null ? null : _currentBack.save; } else { r._currentBack = _currentBack.save; } r.reachedFinalElement = reachedFinalElement; } return r; } } -- |
October 06, 2021 [Issue 22359] joiner over an empty forward range object liable to segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22359 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> --- @adamdruppe created dlang/phobos pull request #8263 "Fix issue #22359." fixing this issue: - Fix issue #22359. If you pass it a range of class-based ranges, the initialization to `typeof(_current).init` will be `null`. Calling the `save` method on `null` will naturally be a memory violation. This generic check will handle null without harming any other type since save of any init value will be another init value. https://github.com/dlang/phobos/pull/8263 -- |
October 09, 2021 [Issue 22359] joiner over an empty forward range object liable to segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22359 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/phobos pull request #8263 "Fix issue #22359 - joiner over an empty class range liable to segfault" was merged into master: - ff6920bd8a461393dcdb7d01edb9b62bcb9bf4d1 by Adam D. Ruppe: Fix issue #22359 - joiner over an empty forward range object liable to segfault If you pass it a range of class-based ranges, the initialization to `typeof(_current).init` will be `null`. Calling the `save` method on `null` will naturally be a memory violation. This generic check will handle null without harming any other type since save of any init value will be another init value. https://github.com/dlang/phobos/pull/8263 -- |
Copyright © 1999-2021 by the D Language Foundation