[Issue 15293] [REG2.069.0] std.stdio.readln(buffer) messes up buffer's capacity
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Nov 13 07:40:44 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15293
--- Comment #14 from github-bugzilla at puremagic.com ---
Commits pushed to stable at https://github.com/D-Programming-Language/phobos
https://github.com/D-Programming-Language/phobos/commit/994d6b81815bc70ab8507ece7285b49ef5ce6d2d
fix issue 15293
ReadlnAppender tried to claim the capacity of the passed buffer, calling
assumeSafeAppend on the result so that on the next call it has a capacity
again that can be claimed.
The obvious problem with that: readln would stomp over memory that it has
not been given.
There was also a subtler problem with it (which caused issue 15293):
When readln wasn't called with the previous line, but with the original
buffer (byLine does that), then the passed buffer had no capacity, so
ReadlnAppender would not assumeSafeAppend when slicing the new line from
it. But without a new assumeSafeAppend, the last one would still be in
effect, possibly on a sub slice of the new line.
https://github.com/D-Programming-Language/phobos/commit/fc77dbbfa93d126c5dfec7c03cc8939b819c09a9
Merge pull request #3802 from aG0aep6G/15293
fix issue 15293
--
More information about the Digitalmars-d-bugs
mailing list