basho / erlang_js

A linked-in driver for Erlang to Mozilla's Spidermonkey Javascript runtime.
Apache License 2.0
238 stars 88 forks source link

Crash on oom #19

Closed msantos closed 12 years ago

msantos commented 12 years ago

Some small safety fixes, if anything looks weird or you'd like some changes, please let me know! I've run the tests and everything passed.

jaredmorrow commented 12 years ago

@msantos I wish I noticed this PR last week. I fixed a few bugs in erlang_js that were causing segfaults on otp 15B and having never looked at the erlang_js code I didn't know we were so vulnerable to OOM. Thanks for the PR, I'll try and look at this after our next release.

msantos commented 12 years ago

Thanks for looking at it! I've reapplied my patches on top of your changes.

Skamatam commented 12 years ago

+1

joecaswell commented 12 years ago

+1

chardan commented 12 years ago

+1 Looks good.

It might be nice for maintenance to peek at (driver_comm.c, 37) using the copy_string() function here instead of the bare code if it's safe (it looks ilke we're still dealing with NULL-terminated strings).

Not created in this change, but copy_string() might be better-named ejs_strdup() to be more consistent with the standard library in a future pass.