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

DivZero Issue #21

Open
MinghaoLin2000 opened this issue Aug 21, 2024 · 0 comments
Open

DivZero Issue #21

MinghaoLin2000 opened this issue Aug 21, 2024 · 0 comments

Comments

@MinghaoLin2000
Copy link

I audited the source code for this project. I found DIV doesn't limit the zero. For instance, below is an example.
`
case DIV: {
registers[A] = stack[SP];
SP = SP - 1;

        registers[B] = stack[SP];
        /* SP = SP - 1;*/
        printf("registera:%d\n",registers[A]);
        registers[C] = registers[B] / registers[A];

        /* SP = SP + 1; */
        stack[SP] = registers[C];
        printf("%d / %d = %d\n", registers[B], registers[A], registers[C]);
        break;
    }

I can control the register[A] into zero, which will cause the DIV zero issue.
[mac]% ./mac DIVZero_poc.mac
[1] 34092 floating point exception ./mac DIVZero_poc.mac
`
I have attached my poc.
DIVZero_poc.mac.zip

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