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

Comments

Projects
None yet
1 participant
@vicuna
Copy link

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

This comment has been minimized.

Copy link
Author

commented Mar 17, 2016

Comment author: @gasche

See the corresponding pull request: #510

@vicuna

This comment has been minimized.

Copy link
Author

commented Apr 15, 2016

Comment author: @damiendoligez

Fixed (see #510).

@vicuna vicuna closed this 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
You can’t perform that action at this time.