Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division by zero crash in assembler constant expressions #347

Open
Tho-Del opened this issue Mar 5, 2024 · 0 comments
Open

Division by zero crash in assembler constant expressions #347

Tho-Del opened this issue Mar 5, 2024 · 0 comments

Comments

@Tho-Del
Copy link

Tho-Del commented Mar 5, 2024

If an instruction that takes an immediate has a constant expression with denominator that is evaluated to 0, Ripes will crash from a division by zero evaluation error.

On windows, this error will require system registry edits to recover from, as the simulator loads and assembles the program before it can be edited, and the source code window is stored in the registry.
The relevant field is sourcecode in HKEY_CURRENT_USER\Softwware\Ripes\Ripes in the Registry Editor.
Setting sourcecode empty or delete the relevant code enables Ripes to run without an instant crash again.

To reproduce:

paste

la x0 0/0

or

start:
la x0 start/start

into Source code in Assembly mode. Upon assembling, Ripes will crash.

Cause:

Ripes/src/assembler/expreval.cpp evaluates assembler constant expression without checking for zero in denominator.
Also crashes with modulus % operator.

Tested in Ripes v2.2.6-41, windows 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant