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

Exceeeding stack limit without growing stack buffer #7168

Closed
vicuna opened this issue Mar 7, 2016 · 2 comments
Closed

Exceeeding stack limit without growing stack buffer #7168

vicuna opened this issue Mar 7, 2016 · 2 comments
Milestone

Comments

@vicuna
Copy link

vicuna commented Mar 7, 2016

Original bug ID: 7168
Reporter: @jhjourdan
Status: closed (set by @damiendoligez on 2016-04-15T09:30:00Z)
Resolution: fixed
Priority: normal
Severity: crash
Platform: amd64
OS: Linux
Version: 4.03.0+dev / +beta1
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: runtime system and C interface

Bug description

When compiling and running the attached program in bytecode mode, I get a libc error (free(): invalid pointer).

The reason is that the interpreter stack is exceeded without being reallocated. The estimation of stack usage computed in bytegen.ml is too optimistic in some cases. The situation is even worsened by Setup_for_event, which can use up to 6 stack slots at any time.

I can see two solutions: either we implement a precise stack usage approximation, but this can be difficult to take into account all the situations, or I suggest using a large security margin when allocation the stack buffer (e.g. 1k word).

File attachments

@vicuna
Copy link
Author

vicuna commented Mar 17, 2016

Comment author: @gasche

See the corresponding pull request: #510

@vicuna
Copy link
Author

vicuna commented Apr 15, 2016

Comment author: @damiendoligez

Fixed (see #510).

@vicuna vicuna closed this as completed Apr 15, 2016
@vicuna vicuna added the stdlib label Mar 14, 2019
@vicuna vicuna added this to the 4.03.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant