-
Notifications
You must be signed in to change notification settings - Fork 683
Use const object parameters in getter API functions #1047
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
Use const object parameters in getter API functions #1047
Conversation
@@ -392,7 +392,7 @@ ecma_op_function_object_get_own_property (ecma_object_t *obj_p, /**< the functio | |||
} | |||
else if (!ecma_get_object_is_builtin (obj_p)) | |||
{ | |||
prop_p = ecma_op_function_try_lazy_instantiate_property (obj_p, property_name_p); | |||
prop_p = ecma_op_function_try_lazy_instantiate_property ((ecma_object_t *) obj_p, property_name_p); |
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.
IMHO, this cast makes the patch ugly and non-secure. Any suggestion to avoid this?
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 cannot avoid this, since reading a property (length for example) might also trigger its construction. Hence the object is extended, and an out-of-memory error can stop the engine.
This is a WIP patch. There are few const to non-const cast in the code that shouldn't be there. |
dfdda5f
to
f63c3f2
Compare
What is the plan with this patch? Shall we move the property hash map creation into some other place? Or make it error tolerant? |
@zherczeg, good question. :) I think the API change is still needed and the referred issue is valid and open in a long time, so we should do something with it. Moving the property hash map creation sounds good to me, but currently no idea how to do it. Any specific idea? |
Perhaps we can move it when a property is assigned. But that does not easy either. |
f63c3f2
to
56dd68c
Compare
Related issue: jerryscript-project#668 JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
56dd68c
to
6471e03
Compare
Won't fix. |
Related issue: #668
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com