Skip to content

Mounted host file access overflows above 2 GiB on Windows (official 2025.12.01 VS SDL1 64-bit build) #6198

@Andresmaga

Description

@Andresmaga

Describe the bug

On Windows x64, DOSBox-X fails when a DOS application accesses a mounted host file slightly above 2 GiB.

In my case this happens with RM/COBOL-85 Runtime for DOS and a large data file mounted from a Windows host directory. The same DOS runtime, program, and data work correctly in a 32-bit Windows environment, but fail inside DOSBox-X when the file is accessed from a mounted host drive.

The DOS application aborts with:

COBOL I/O error 30,131 on FAC-FILE file F:\VENTAS\LOC-FACT.DAT.
COBOL I/O error at line 2758 in NE253 (F:\VENTAS\NE253.COB) compiled 26/04/07
10:45:53.

The file size is 2149580800 bytes, which is slightly above 2147483647, so this appears consistent with a signed 32-bit file positioning overflow in the mounted local drive path.

Steps to reproduce the behaviour

  1. On Windows x64, mount a host directory as a DOS drive in DOSBox-X.
  2. Run a DOS application that opens a large file from that mounted host directory.
  3. In my case:
    • DOS runtime: M/COBOL-85 Runtime - Version 5.01.01 for DOS 2.00+
    • Program: NE253.COB
    • File opened: F:\VENTAS\LOC-FACT.DAT
    • File size: 2149580800 bytes
  4. Use DOSBox-X with a mounted host directory and reproduce the file access.
  5. The program aborts with the above I/O error.

Expected behavior

The file should be accessed normally, the same way it is with the same DOS runtime/program/data in a 32-bit Windows environment.

What operating system(s) this bug have occurred on?

Windows 11 64-bit 25H2

What version(s) of DOSBox-X have this bug?

2025.12.01 Commit 10a5ce7 (Visual Studio SDL1 64-bit)

Used configuration

[sdl]
windowposition    = 
output            = ttf
clip_key_modifier = none

[dosbox]
language                 = es_ES
isa memory hole at 512kb = false
nocachedir               = true

[cpu]
core    = dynamic
cputype = pentium
cycles  = max

[mixer]
rate = 44100

[midi]
samplerate = 44100

[sblaster]
oplrate = 44100

[gus]
gusrate = 44100

[speaker]
pcrate    = 44100
tandyrate = 44100

[serial]
serial1 = directserial

[parallel]
parallel1 = file append:C:\Users\PCA\filename.txt

[printer]
printoutput = printer

[dos]
hard drive data rate limit   = 0
floppy drive data rate limit = 0
file access tries            = 3
ver                          = 7.1
autofixwarning               = true
starttranspath               = false
keyboardlayout               = sp
dos clipboard api            = true

[ne2000]
macaddr = AC:DE:48:88:99:AA

[4dos]

[config]
fcbs        = 100
files       = 200
country     = 34,858
set path    = Z:\;Z:\SYSTEM;Z:\BIN;Z:\DOS;Z:\4DOS;Z:\DEBUG;Z:\TEXTUTIL
set prompt  = $P$G
set temp    = 

[autoexec]
MOUNT F E:\
F:
CD\VENTAS
SET LPT1=LPT1
SET TAB-FILE.DAT=TAB-FILE.DAT
SET LOC-STOC.DAT=LOC-STOC.DAT
SET COSTO.DAT=COSTO.DAT
KEYB SP 850

Output log

Relevant excerpt from the official DOSBox-X build log:

1938122743       FILES:Special file open command 40 file F:\VENTAS\LOC-FACT.DAT
1938129299 DEBUG FILES:Seeking to 0 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1938129430 DEBUG FILES:Reading 256 bytes from VENTAS\LOC-FACT.DAT
1938132031 DEBUG FILES:Seeking to 0 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1938132162 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1938283761 DEBUG FILES:Seeking to 0 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1938283892 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1938285495 DEBUG FILES:Seeking to 1326053376 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1938285626 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1938287485 DEBUG FILES:Seeking to 1325959168 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1938287616 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1938291747 DEBUG FILES:Seeking to 2055124992 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1938291878 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1938295337 DEBUG FILES:Seeking to 2146813952 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1938295468 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1974941524 DEBUG FILES:Seeking to 0 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1974941655 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1974943674 DEBUG FILES:Seeking to -2146435072 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1975053217 DEBUG FILES:Seeking to 0 bytes from position type (0) in VENTAS\LOC-FACT.DAT
1975053348 DEBUG FILES:Reading 2048 bytes from VENTAS\LOC-FACT.DAT
1975058609       FILES:Closing file VENTAS\LOC-FACT.DAT

The important part is that position type (0) appears to be an absolute seek, but the logged target becomes negative once the file position crosses the 2 GiB boundary.

Additional information

This appears to be specific to DOSBox-X mounted host file handling rather than to the DOS application itself.

I tested the same DOS runtime, program, and data outside DOSBox-X in a 32-bit Windows environment and it works correctly.

I also locally investigated the problem in src/dos/drive_local.cpp and tested a source-modified build of my own for investigation purposes. With that build, the same scenario no longer reproduced and the program completed successfully.

I am not claiming that my local source change is necessarily the final upstream fix, only that it appears to confirm the problem is in DOSBox-X mounted local file positioning for files above 2 GiB.

This may be related in a broad sense to older >2GB storage issues, but my case is specifically about a host-mounted file accessed through a mounted drive, not a disk image format such as VHD/QCOW2 or an IMG-mounted disk.

If useful, I can also provide:

  • the full official build log
  • the minimal modified config
  • notes from the local source investigation in src/dos/drive_local.cpp

largefile.log

Have you checked that no similar bug report(s) exist?

  • I have searched and didn't find any similar bug report.

Code of Conduct & Contributing Guidelines

  • I agree to follow the code of conduct and the contributing guidelines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions