Bug 3363 – std.stream.readf segfaults with immutable format strings

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
Other
OS
Linux
Creation time
2009-10-04T14:23:00Z
Last change time
2014-07-11T23:28:01Z
Keywords
patch, pull, rejects-valid
Assigned to
nobody
Creator
acehreli

Comments

Comment #0 by acehreli — 2009-10-04T14:23:03Z
This program segfaults when run and receives an int from din: import std.cstream; void main() { int i; din.readf("%d", &i); } The reason is because vreadf does not think that "%d" is a format string, probably because the following 'is' expression doesn't match immutable (char)[]: std/stream.d:694: if (arguments[j] is typeid(char[])) { The program above works as expected when readf receives "%d".dup Ali
Comment #1 by witold.baryluk+d — 2010-12-01T11:38:23Z
Why this bug isn't fixed yet? It is trivial to fix and important, as many users (especially beginners) will encounter this problem. changing std/stream.d:694: if (arguments[j] is typeid(char[])) { into if (arguments[j] is typeid(string) || arguments[j] is typeid(char[])) { would fix it right?
Comment #2 by briancschott — 2014-06-02T20:05:19Z
Comment #3 by github-bugzilla — 2014-07-11T23:28:00Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/141a088e378ac9b97f63ea044ff160a7c0310369 Fix issue 3363: std.stream.readf segfaults with immutabel format strings https://github.com/D-Programming-Language/phobos/commit/911ea3144397665a3ddf282e2e38bca104f3f50e Merge pull request #2224 from Hackerpilot/issue-3363 Fix issue 3363: std.stream.readf segfaults with immutable format strings