robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
396 stars 48 forks source link

PC-BASIC 2.0.4 crashes with IndexError when --max-memory value is too large #165

Closed rbergen closed 2 years ago

rbergen commented 2 years ago

Bug report

Problem When a value greater than 65534 is passed to the --max-memory command line parameter, PC-BASIC crashes with an IndexError, instead of ignoring the invalid value.

Steps

  1. Start PC-BASIC with --max-memory=65535 (or any value over 65534)

Crash log Text output to stdout:

[09:19:02.0380] WARNING: max-memory value > 65534
[09:19:02.0380] WARNING: Value "max-memory=65535" ignored; invalid
[09:19:03.0655] ERROR: Unhandled exception
Traceback (most recent call last):
  File "/home/rutger/source/pcbasic/pcbasic/main.py", line 29, in main
    run(*arguments)
  File "/home/rutger/source/pcbasic/pcbasic/main.py", line 64, in run
    _launch_session(settings)
  File "/home/rutger/source/pcbasic/pcbasic/main.py", line 97, in _launch_session
    Interface(guard, **settings.iface_params).launch(_run_session, **settings.launch_params)
  File "/home/rutger/source/pcbasic/pcbasic/config.py", line 818, in launch_params
    greeting = not run and not commands and not self.session_params['input_streams']
  File "/home/rutger/source/pcbasic/pcbasic/config.py", line 538, in session_params
    max_list[1] = max_list[1]*16 if max_list[1] else max_list[0]
IndexError: list index out of range

Notes PC-BASIC version: 2.0.4 Operating system version: Windows 10 with WSL2/Ubuntu; also confirmed when running PC-BASIC directly on Windows 10

I'm only opening an issue for this so that the issue list includes this known issue in 2.0.4. I've already opened #156 to address it.

robhagemans commented 2 years ago

Resolved by merging #156. Thanks!