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

using initarand() and arand() leads to random code execution (gbdk 4.0, linux) #53

Closed
bbbbbr opened this issue Oct 4, 2020 · 3 comments

Comments

@bbbbbr
Copy link
Collaborator

bbbbbr commented Oct 4, 2020

I haven't identified the specific problem, but it looks like calling initarand() and arand() will cause the current program to eventually start executing random code (at least in one case SP decrements endlessly).

You can test this with the "rand.c" sample (or "dscan" sample which also uses arand). It typically takes about 10-13 iterations of the main loop before something bad happens. If it is changed to only use initrand() and rand() the problem does not appear to manifest.

At first glance it does not seem like changes to arand.s (vs 2.95) are the source of the problem.

For reference, the rand.c sample from the gbdk 2.95 built against 2.95 does not look like it has this problem.

@untoxa
Copy link
Collaborator

untoxa commented Oct 4, 2020

please make a minimal example, that demonstrates the problem.

@untoxa
Copy link
Collaborator

untoxa commented Oct 4, 2020

rand.c example works fine

@bbbbbr
Copy link
Collaborator Author

bbbbbr commented Oct 5, 2020

The patch looks like it fixed the issue. Closing the ticket.

Thanks!

@bbbbbr bbbbbr closed this as completed Oct 5, 2020
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

2 participants