-
Notifications
You must be signed in to change notification settings - Fork 192
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
malloc Fails Silently in wasi-sdk #518
Comments
You're unfortunately running up against the world of integer casts in C. Then you're running into the fact that More-or-less I don't think there's a bug here. |
To add to that, the emscripten program stops at 32MB because of the default memory size, and that growth is disabled by default (the defaults are motivated by what is generally best for programs running on the web). But you can allow more, |
Thank you, @kripken and @alexcrichton. That makes sense. |
Description
When running the following C program, different behaviors are observed between
wasi-sdk
andemscripten
. Specifically,wasi-sdk
fails to detect unsuccessful memory allocations, leading to an infinite loop.Reproduction Steps
wasi-sdk
andemscripten
:wasi-sdk
:Output (wasi-sdk)
emscripten
:Output (emscripten)
Expected Behavior
malloc
should returnNULL
when memory allocation fails.Actual Behavior (wasi-sdk)
malloc
continues returning non-NULL pointers even for unreasonably large allocations.The text was updated successfully, but these errors were encountered: