Skip to content
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

Assert in Object.getPrototypeOf function #208

Closed
kkristof opened this issue Jun 18, 2015 · 2 comments
Closed

Assert in Object.getPrototypeOf function #208

kkristof opened this issue Jun 18, 2015 · 2 comments
Labels
bug Undesired behaviour ecma builtins Related to ECMA built-in routines
Milestone

Comments

@kkristof
Copy link
Contributor

Hi, I'm currently working on the Object.create built-in function and I've found that the following code cause below causes assertion.
The test:

var obj = Object.create(null);
Object.getPrototypeOf (obj);

The assertion:

ICE: Assertion 'object_p != NULL' failed at /home/kristof/work/jerryscript/jerry-core/ecma/base/ecma-helpers-value.cpp(ecma_make_object_value):267.
Error: ERR_FAILED_INTERNAL_ASSERTION

Backtrace:

#0  0x00000000004d9ae5 in syscall_2_asm () at /home/kristof/work/jerryscript/jerry-libc/target/linux/jerry-asm.S:32
#1  0x000000000040099a in syscall_2 (syscall_no=62, arg1=6944, arg2=6) at /home/kristof/work/jerryscript/jerry-libc/target/linux/jerry-libc-target.c:96
#2  0x0000000000400b3b in abort () at /home/kristof/work/jerryscript/jerry-libc/target/linux/jerry-libc-target.c:175
#3  0x000000000045c10b in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at /home/kristof/work/jerryscript/jerry-core/jrt/jrt-fatals.cpp:70
#4  0x000000000045c15a in jerry_assert_fail (assertion=0x4f2ce7 "object_p != NULL", file=0x4f2c78 "/home/kristof/work/jerryscript/jerry-core/ecma/base/ecma-helpers-value.cpp", 
    function=0x4dccf0 <_ZZ22ecma_make_object_valuePK13ecma_object_tE8__func__.25845> "ecma_make_object_value", line=267) at /home/kristof/work/jerryscript/jerry-core/jrt/jrt-fatals.cpp:97
#5  0x000000000048a97f in ecma_make_object_value (object_p=0x0) at /home/kristof/work/jerryscript/jerry-core/ecma/base/ecma-helpers-value.cpp:267
#6  0x00000000004223ec in ecma_builtin_object_object_get_prototype_of (this_arg=1807, arg=2855) at /home/kristof/work/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-object.cpp:133
...
@kkristof kkristof added bug Undesired behaviour ecma builtins Related to ECMA built-in routines labels Jun 18, 2015
@kkristof kkristof added this to the ECMA builtins milestone Jun 18, 2015
@kkristof
Copy link
Contributor Author

Note that, on the current master this isn't reproducible because the only way to create any object with the prototype of null is using the Object.create.

cc @bzsolt @galpeter

@kkristof kkristof changed the title Assert in Object.getPrototype function Assert in Object.getPrototypeOf function Jun 18, 2015
@galpeter
Copy link
Contributor

The problem seems to be that the ecma_get_object_prototype return a null pointer and we call the ecma_make_object_value on it. Probably we should check and if such case occurs return a simple null value instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour ecma builtins Related to ECMA built-in routines
Projects
None yet
Development

No branches or pull requests

2 participants