When creating a computer with, say, ID 2147483648, weird things occur. If the command-line --id flag is used, I get this:
$ craftos --id 2147483648
terminate called after throwing an instance of 'std::out_of_range'
what(): stoi
zsh: IOT instruction (core dumped) craftos --id 2147483648
When using attach 2147483648 computer inside of an existing window, a computer with ID -2147483648 is created (emphasis on the negative). This computer is frozen; the user cannot interact with it, and the process must be killed manually.
This seems like an integer overflow bug, but I'm not a C++ developer so I'm not sure.
To Reproduce
See above
Expected behavior
A clean, human-readable error when a user tries to make a computer with an ID greater than 2147483647 in the CLI and inside of the emulator.
Screenshots
(the strange frozen window)
See also: the error placed above
Environment (please complete the following information):
OS: NixOS
OS Version: 24.05 Uakari (kernel 6.6.22; i3wm version 4.23)
CraftOS-PC Version: CraftOS-PC v2.8.1
Compiled from source? No (installed from Nix binary cache)
Describe the bug
When creating a computer with, say, ID 2147483648, weird things occur. If the command-line
--id
flag is used, I get this:When using
attach 2147483648 computer
inside of an existing window, a computer with ID-2147483648
is created (emphasis on the negative). This computer is frozen; the user cannot interact with it, and the process must be killed manually.This seems like an integer overflow bug, but I'm not a C++ developer so I'm not sure.
To Reproduce See above
Expected behavior A clean, human-readable error when a user tries to make a computer with an ID greater than 2147483647 in the CLI and inside of the emulator.
Screenshots (the strange frozen window)
See also: the error placed above
Environment (please complete the following information):
Additional context N/A