Closed davepacheco closed 7 years ago
I've got a change to fix this (and release v1.2.1 at the same time) at https://cr.joyent.us/2628.
PS1 is make prepush
clean on Node v0.10.46. I believe it is also zero risk, in that the only case that could be affected by the code change is one that would have previously crashed anyway.
mdb_v8 crashed here:
On the original core file, using mdb_v8 v1.2.0, I can replicate this with just:
Here's the underlying function:
jsclosure loads the v8function (bb1f78dd), gets its context (bb1e1f51), and gets the context's scopeinfo. To do that last step, we get the context's closure (bb1e0385), then load that as a function, and gets its scopeinfo:
So for the original closure bb1f78dd, the context is bb1e1f51, and the scopeinfo is 8a393855. Sure enough, that scopeinfo has two context-local variables:
but the closure we have for it only has one slot:
I suspect that's because this is garbage, though it's hard to say for sure in this core file.
While iterating the variables, we call
v8context_var_value
to get the value of the ith variable, and we blow an assertion because there aren't that many slots in the context. What's weird is that we actually have a check for this, but I think it's checking the wrong thing. It's checkingi
, the user's argument, against the number of entries in the context array. However, the real index isidx
, which is offset fromi
because of static fields at the front of the context array. I think the check just needs to be updated to checkidx
rather thani
.