[Issue 18988] New: Reading from unreadable file results in random garbage
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jun 15 01:05:48 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18988
Issue ID: 18988
Summary: Reading from unreadable file results in random garbage
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: elpenguino+D at gmail.com
Attempting to read from a file opened only for writing on Windows (10, build
17134, 64-bit) after writing to the file does not throw an exception when read
from, nor does it produce a valid result.
```
import std.stdio;
void main()
{
auto x = File("hi", "w");
x.write("Hello.");
ubyte[4096] buf;
auto slice = x.rawRead(buf);
assert(slice.length == 0); //Fails.
assert(slice == new ubyte[](slice.length)); //Also fails.
}
```
This only occurs when compiled with -m32. -m32mscoff and -m64 throw exceptions
as expected.
--
More information about the Digitalmars-d-bugs
mailing list