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

Stack leak, eventually causing overflow #11

Closed
hikari-no-yume opened this issue Jun 12, 2023 · 3 comments
Closed

Stack leak, eventually causing overflow #11

hikari-no-yume opened this issue Jun 12, 2023 · 3 comments

Comments

@hikari-no-yume
Copy link
Collaborator

hikari-no-yume commented Jun 12, 2023

If you do make test and disable the code in tests that makes failed assertions crash, uxnemu eventually complains you've gotten a working-stack overflow. I've also seen this in one of my own programs that has animation with the screen vector. So I assume there's some push/pop mismatch, a stack leak of sorts.

@hikari-no-yume hikari-no-yume changed the title Stack leak, eventually causing overflow Working stack leak, eventually causing overflow Jun 12, 2023
@hikari-no-yume
Copy link
Collaborator Author

hikari-no-yume commented Jun 13, 2023

Hmm, actually, the integer signedness branch passes almost all the tests now and doesn't have any overflows in that suite. Maybe the bug here was fixed?

@hikari-no-yume
Copy link
Collaborator Author

This still happens for my little animation program. The problem is that the in-memory stack (@rbp) has a leak and eventually overflows and corrupts something, and that leads to a working-stack overflow. The problem is that brk(); in vectors means that the stack pointer is never decremented at the end of a function:

@screen_
  .rbp LDZ2 #0002 SUB2 .rbp STZ2
  (…)
  BRK
  POP2
  #0000
@.L.return.screen
  .rbp LDZ2 #0002 ADD2 .rbp STZ2
  JMP2r

@hikari-no-yume hikari-no-yume changed the title Working stack leak, eventually causing overflow Stack leak, eventually causing overflow Jun 14, 2023
@lynn
Copy link
Owner

lynn commented Jun 15, 2023

Fixed, I suppose, by overhauling the Varvara vector API and getting rid of brk().

@lynn lynn closed this as completed Jun 15, 2023
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