Bug 18988 – Reading from unreadable file results in random garbage

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-06-15T01:05:48Z
Last change time
2024-12-01T16:33:57Z
Assigned to
No Owner
Creator
elpenguino+D
Moved to GitHub: phobos#10342 →

Comments

Comment #0 by elpenguino+D — 2018-06-15T01:05:48Z
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.
Comment #1 by robert.schadek — 2024-12-01T16:33:57Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10342 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB