[Issue 19797] New: File.seek() terminates ungracefully on incorrect origin for -m32mscoff and -m64

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 9 10:21:30 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19797

          Issue ID: 19797
           Summary: File.seek() terminates ungracefully on incorrect
                    origin for -m32mscoff and -m64
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: Bastiaan at Veelo.net

The origin parameter to File.seek() should only accept SEEK_STEP, SEEK_CUR or
SEEK_END. When a different int is passed, an exception is correctly thrown when
compiled with -m32. However, on Windows 10 at least, when compiled with either
-m32mscoff or -m64, the process terminates without any message whatsoever.

import std.experimental.all;

void main()
{       
        auto deleteme = "deleteme";
        auto f = File(deleteme, "wb+");
        scope(exit) { f.close(); std.file.remove(deleteme); }
        f.seek(0, 3);   // Should throw.

        writeln("Ending gracefully."); // Never seen.
}

--


More information about the Digitalmars-d-bugs mailing list