[Issue 24165] New: Failed readf leaves File in inconsistent state
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 26 17:29:23 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24165
Issue ID: 24165
Summary: Failed readf leaves File in inconsistent state
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: snarwin+bugzilla at gmail.com
Example:
---
$ echo "-hello" > input
$ cat example.d
import std.stdio, std.format, std.algorithm;
void main()
{
auto f = File("input");
int n;
try f.readf("%d", n);
catch (Exception e) {}
f.byChunk(1).copy(stdout.lockingBinaryWriter);
}
$ dmd -run example.d
hhello
---
After the failed call to File.readf, subsequent reads from `f` result in
corrupted data.
--
More information about the Digitalmars-d-bugs
mailing list