Skip to content

Long command line "Out of Memory"; Set /E, SET /P bug #105

Closed
@shidel

Description

This test was performed on FreeCOM running inside DOSBox using the DOSBox kernel.

I'm sorry, I wasn't thinking and did something dumb in a batch file which caused FreeCOM to break... Again.

My intent was to create a simple crazy big text file for some testing. I was doing this using a couple V8Power Tools programs using this batch:

@echo off

set max=50
set line=0
set /e str=vstr /r 235 /c 0xfe
:repeating
if "%line%" == "%max%" goto done
set /e line=vmath %line% + 1
set /e hex=vmath %line% /h
echo %hex% %str%
goto repeating
:done

The vstr /r 235 /c 0xfe is repeat the next option 235 times, the next option being output ASCII 0xfe to StdOut.
The vmath %line% + 1 is add 1 to %line%
The vmath %line% /h is output result as hexadecimal.

The obviously dumb thing I did was repeating the character 235 times. This exceeds the maximum line length of 125 characters in batch files. Running this batch resulted in this output:

Screen Shot 2024-07-02 at 4 11 57 PM

All of those errors about the length exceeding the maximum should be expected. However, the "out of memory error." was a surprise. Even more of a surprise is that the error is non-recoverable and required closing DOSBox.

Screen Shot 2024-07-02 at 4 28 35 PM

By reducing the number of repeated output characters to a sane number like 40, the batch will happily iterate through the requested lines until the max value is reached without any issues.

If I REM out the echo %hex% %str% and keep the 235 character output, the issue still occurs.

So, I ran a bunch of tests using different repeat counts. Everything worked fine until I used 231 characters for the repeat count. Then the Out of Memory Error occurs.

Interestingly, at 230 characters the batch generates no errors and creates output like this:

Screen Shot 2024-07-02 at 4 48 17 PM

I just realized I should perform this test under the latest FreeCOM build created by ECM. It is actually worse. When run it looks like this:

Screen Shot 2024-07-02 at 4 53 35 PM

However, after pressing a key. It sometimes causes DOSBox to close. It sometimes generates things like this and freezes:

Screen Shot 2024-07-02 at 4 54 01 PM

Like the older version of FreeCOM, the latest build is fine if the repeated character length is 230 or less.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions