-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix #34159, crash in deserialize caused by recent layout changes #34163
Conversation
src/dump.c
Outdated
ios_write(s->s, (char*)&n, sizeof(n)); | ||
last = ptr + sizeof(n); | ||
} | ||
else if (j < np && ptr == (char*)&((jl_value_t**)data)[jl_ptr_offset(t, j)]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs while ptr > jl_ptr_offset(t, j) { /* write out previous field */ }
Agreed. This is a better approach. I was alternatively also thinking about copying the value into temporary space ( |
fe3d8cc
to
36345fb
Compare
src/dump.c
Outdated
ios_write(s->s, last, prevptr - last); | ||
jl_value_t *e = *(jl_value_t**)prevptr; | ||
JL_GC_PROMISE_ROOTED(e); | ||
if (t->mutabl && e && jl_is_cpointer(e) && jl_unbox_voidpointer(e) != (void*)-1 && jl_unbox_voidpointer(e) != NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want jl_field_type(t, i)->mutabl
here (but that's always false)
if (t->mutabl && e && jl_is_cpointer(e) && jl_unbox_voidpointer(e) != (void*)-1 && jl_unbox_voidpointer(e) != NULL) | |
if (0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, we need some kind of check for whether this is a direct field of the object. Maybe checking that jl_field_type(t, i-1)
is concrete and inlinealloc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. We probably want t->mutable && jl_field_isptr(t, i - 1) && jl_is_cpointer(e) &&
then?
36345fb
to
ec28a0f
Compare
The field types are not necessarily available at this point in deserialization. I also like this implementation a bit better since it always handles null-ing C pointers on the serialize side.