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

Assertion 'read == len' failed in iotjs_file_read #1351

Closed
renatahodovan opened this issue Dec 5, 2017 · 0 comments
Closed

Assertion 'read == len' failed in iotjs_file_read #1351

renatahodovan opened this issue Dec 5, 2017 · 0 comments

Comments

@renatahodovan
Copy link
Contributor

IoT.js version:
Checked revision: a6b2d75
Build command: tools/build.py --buildtype debug --no-snapshot --no-check-test --target-arch (i686|x86_64)
OS:
Ubuntu 17.10
Test case:
process.readSource('docs');

Note: the parameter of readSource has to point to an existing directory.

Backtrace:

The test case triggers different assertion failures on different builds.

with i686-linux target:

iotjs/src/iotjs_util.c:55: Assertion 'read == len' failed.

Breakpoint 1, iotjs_file_read (path=0x5668a210 "deps") at iotjs/src/iotjs_util.c:55
55    IOTJS_ASSERT(read == len);
(gdb) bt
#0  iotjs_file_read (path=0x5668a210 "deps") at iotjs/src/iotjs_util.c:55
#1  0x56576b59 in ReadSource (jfunc=1449435195, jthis=1449435115, jargv=0xffffc308, jargc=1)
    at iotjs/src/modules/iotjs_module_process.c:145
#2  0x5659d00f in ecma_op_function_call (func_obj_p=0x5664a038 <jerry_global_heap+184>, this_arg_value=1449435115, 
    arguments_list_p=0xffffc308, arguments_list_len=1)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:467
#3  0x565adab9 in opfunc_call (frame_ctx_p=0xffffc334) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#4  0x565b293a in vm_execute (frame_ctx_p=0xffffc334, arg_p=0xffffc624, arg_list_len=3)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#5  0x565b2b1c in vm_run (bytecode_header_p=0x5664fc50 <jerry_global_heap+23760>, this_binding_value=1449456915, 
    lex_env_p=0x56649fa8 <jerry_global_heap+40>, is_eval_code=false, arg_list_p=0xffffc624, arg_list_len=3)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#6  0x5659cfa6 in ecma_op_function_call (func_obj_p=0x5664fb50 <jerry_global_heap+23504>, this_arg_value=1449456915, 
    arguments_list_p=0xffffc624, arguments_list_len=3)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#7  0x565bfe10 in ecma_builtin_function_prototype_object_call (this_arg=1449458515, arguments_list_p=0xffffc620, arguments_number=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:206
#8  0x565bf7b8 in ecma_builtin_function_prototype_dispatch_routine (builtin_routine_id=36, this_arg_value=1449458515, 
    arguments_list=0xffffc620, arguments_number=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h:42
#9  0x5659950d in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, builtin_routine_id=36, 
    this_arg_value=1449458515, arguments_list=0xffffc620, arguments_number=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:108
#10 0x56599a66 in ecma_builtin_dispatch_call (obj_p=0x5664cca0 <jerry_global_heap+11552>, this_arg_value=1449458515, arguments_list_p=0xffffc620, arguments_list_len=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#11 0x5659ce3b in ecma_op_function_call (func_obj_p=0x5664cca0 <jerry_global_heap+11552>, this_arg_value=1449458515, 
    arguments_list_p=0xffffc620, arguments_list_len=4)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:343
#12 0x565adab9 in opfunc_call (frame_ctx_p=0xffffc654) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#13 0x565b293a in vm_execute (frame_ctx_p=0xffffc654, arg_p=0xffffc804, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#14 0x565b2b1c in vm_run (bytecode_header_p=0x5664dc68 <jerry_global_heap+15592>, this_binding_value=1449456891, 
    lex_env_p=0x5664d3c0 <jerry_global_heap+13376>, is_eval_code=false, arg_list_p=0xffffc804, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#15 0x5659cfa6 in ecma_op_function_call (func_obj_p=0x5664f680 <jerry_global_heap+22272>, this_arg_value=1449456891, 
    arguments_list_p=0xffffc804, arguments_list_len=0)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#16 0x565adab9 in opfunc_call (frame_ctx_p=0xffffc844) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#17 0x565b293a in vm_execute (frame_ctx_p=0xffffc844, arg_p=0xffffc9dc, arg_list_len=2)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#18 0x565b2b1c in vm_run (bytecode_header_p=0x5664dcd8 <jerry_global_heap+15704>, this_binding_value=1449447923, 
    lex_env_p=0x5664d3c0 <jerry_global_heap+13376>, is_eval_code=false, arg_list_p=0xffffc9dc, arg_list_len=2)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#19 0x5659cfa6 in ecma_op_function_call (func_obj_p=0x5664f650 <jerry_global_heap+22224>, this_arg_value=1449447923, 
    arguments_list_p=0xffffc9dc, arguments_list_len=2)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#20 0x565adab9 in opfunc_call (frame_ctx_p=0xffffca04) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#21 0x565b293a in vm_execute (frame_ctx_p=0xffffca04, arg_p=0xffffcbc0, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#22 0x565b2b1c in vm_run (bytecode_header_p=0x5664ddf8 <jerry_global_heap+15992>, this_binding_value=1449447923, 
    lex_env_p=0x5664d3c0 <jerry_global_heap+13376>, is_eval_code=false, arg_list_p=0xffffcbc0, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#23 0x5659cfa6 in ecma_op_function_call (func_obj_p=0x5664f690 <jerry_global_heap+22288>, this_arg_value=1449447923, 
    arguments_list_p=0xffffcbc0, arguments_list_len=0)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#24 0x565adab9 in opfunc_call (frame_ctx_p=0xffffcbf4) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#25 0x565b293a in vm_execute (frame_ctx_p=0xffffcbf4, arg_p=0xffffcd80, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#26 0x565b2b1c in vm_run (bytecode_header_p=0x5664afa0 <jerry_global_heap+4128>, this_binding_value=1449435035, 
    lex_env_p=0x5664aa90 <jerry_global_heap+2832>, is_eval_code=false, arg_list_p=0xffffcd80, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#27 0x5659cfa6 in ecma_op_function_call (func_obj_p=0x5664a510 <jerry_global_heap+1424>, this_arg_value=72, arguments_list_p=0xffffcd80, 
    arguments_list_len=0) at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#28 0x565adab9 in opfunc_call (frame_ctx_p=0xffffcda4) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#29 0x565b293a in vm_execute (frame_ctx_p=0xffffcda4, arg_p=0x0, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#30 0x565b2b1c in vm_run (bytecode_header_p=0x5664a600 <jerry_global_heap+1664>, this_binding_value=1449435035, 
    lex_env_p=0x56649fa8 <jerry_global_heap+40>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#31 0x565ad6f7 in vm_run_global (bytecode_p=0x5664a600 <jerry_global_heap+1664>)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:232
#32 0x5657bf6b in jerry_run (func_val=1449436419) at iotjs/deps/jerry/jerry-core/api/jerry.c:558
#33 0x5656905b in iotjs_jhelper_eval (name=0x565ffc44 "iotjs.js", name_len=8, 
    data=0x5660d480 <iotjs_s> "/* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance w"..., size=4256, strict_mode=false, 
    throws=0xffffcf07) at iotjs/src/iotjs_binding.c:346
#34 0x56567992 in iotjs_run (env=0x56649200 <current_env>) at iotjs/src/iotjs.c:100
#35 0x56567a60 in iotjs_start (env=0x56649200 <current_env>) at iotjs/src/iotjs.c:138
#36 0x56567e2a in iotjs_entry (argc=2, argv=0xffffd074) at iotjs/src/iotjs.c:218
#37 0x565675a5 in main (argc=2, argv=0xffffd074) at iotjs/iotjs_linux.c:19

with x86_64-linux target:

iotjs/src/iotjs_util.c:69: Assertion 'buffer != NULL' failed.

Breakpoint 1, iotjs_buffer_allocate (size=9223372036854775808) at iotjs/src/iotjs_util.c:69
69    IOTJS_ASSERT(buffer != NULL);
(gdb) bt
#0  iotjs_buffer_allocate (size=9223372036854775808) at iotjs/src/iotjs_util.c:69
#1  0x0000555555572045 in iotjs_file_read (path=0x55555588c3b0 "deps") at iotjs/src/iotjs_util.c:41
#2  0x000055555557b5dc in ReadSource (jfunc=195, jthis=115, jargv=0x7fffffffcbac, jargc=1)
    at iotjs/src/modules/iotjs_module_process.c:145
#3  0x000055555559e3a9 in ecma_op_function_call (func_obj_p=0x55555584bd60 <jerry_global_heap+192>, this_arg_value=115, 
    arguments_list_p=0x7fffffffcbac, arguments_list_len=1)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:467
#4  0x00005555555af01e in opfunc_call (frame_ctx_p=0x7fffffffcbf0) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#5  0x00005555555b40ed in vm_execute (frame_ctx_p=0x7fffffffcbf0, arg_p=0x7fffffffd008, arg_list_len=3)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#6  0x00005555555b4375 in vm_run (bytecode_header_p=0x5555558519b8 <jerry_global_heap+23832>, this_binding_value=17555, 
    lex_env_p=0x55555584bcc8 <jerry_global_heap+40>, is_eval_code=false, arg_list_p=0x7fffffffd008, arg_list_len=3)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#7  0x000055555559e331 in ecma_op_function_call (func_obj_p=0x555555851880 <jerry_global_heap+23520>, this_arg_value=17555, 
    arguments_list_p=0x7fffffffd008, arguments_list_len=3)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#8  0x00005555555c128d in ecma_builtin_function_prototype_object_call (this_arg=23523, arguments_list_p=0x7fffffffd004, arguments_number=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:206
#9  0x00005555555c0c7c in ecma_builtin_function_prototype_dispatch_routine (builtin_routine_id=36, this_arg_value=23523, 
    arguments_list=0x7fffffffd004, arguments_number=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h:42
#10 0x000055555559aa5f in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, builtin_routine_id=36, 
    this_arg_value=23523, arguments_list=0x7fffffffd004, arguments_number=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:108
#11 0x000055555559ae36 in ecma_builtin_dispatch_call (obj_p=0x55555584e638 <jerry_global_heap+10648>, this_arg_value=23523, 
    arguments_list_p=0x7fffffffd004, arguments_list_len=4)
    at iotjs/deps/jerry/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#12 0x000055555559e16d in ecma_op_function_call (func_obj_p=0x55555584e638 <jerry_global_heap+10648>, this_arg_value=23523, 
    arguments_list_p=0x7fffffffd004, arguments_list_len=4)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:343
#13 0x00005555555af01e in opfunc_call (frame_ctx_p=0x7fffffffd050) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#14 0x00005555555b40ed in vm_execute (frame_ctx_p=0x7fffffffd050, arg_p=0x7fffffffd2d8, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#15 0x00005555555b4375 in vm_run (bytecode_header_p=0x55555584fac0 <jerry_global_heap+15904>, this_binding_value=17315, 
    lex_env_p=0x55555584ef88 <jerry_global_heap+13032>, is_eval_code=false, arg_list_p=0x7fffffffd2d8, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#16 0x000055555559e331 in ecma_op_function_call (func_obj_p=0x555555850f50 <jerry_global_heap+21168>, this_arg_value=17315, 
    arguments_list_p=0x7fffffffd2d8, arguments_list_len=0)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#17 0x00005555555af01e in opfunc_call (frame_ctx_p=0x7fffffffd330) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#18 0x00005555555b40ed in vm_execute (frame_ctx_p=0x7fffffffd330, arg_p=0x7fffffffd5a0, arg_list_len=2)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#19 0x00005555555b4375 in vm_run (bytecode_header_p=0x55555584fce8 <jerry_global_heap+16456>, this_binding_value=12755, 
    lex_env_p=0x55555584ef88 <jerry_global_heap+13032>, is_eval_code=false, arg_list_p=0x7fffffffd5a0, arg_list_len=2)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#20 0x000055555559e331 in ecma_op_function_call (func_obj_p=0x555555850de8 <jerry_global_heap+20808>, this_arg_value=12755, 
    arguments_list_p=0x7fffffffd5a0, arguments_list_len=2)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#21 0x00005555555af01e in opfunc_call (frame_ctx_p=0x7fffffffd5e0) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#22 0x00005555555b40ed in vm_execute (frame_ctx_p=0x7fffffffd5e0, arg_p=0x7fffffffd874, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#23 0x00005555555b4375 in vm_run (bytecode_header_p=0x55555584fb08 <jerry_global_heap+15976>, this_binding_value=12755, 
    lex_env_p=0x55555584ef88 <jerry_global_heap+13032>, is_eval_code=false, arg_list_p=0x7fffffffd874, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#24 0x000055555559e331 in ecma_op_function_call (func_obj_p=0x555555850f60 <jerry_global_heap+21184>, this_arg_value=12755, 
    arguments_list_p=0x7fffffffd874, arguments_list_len=0)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#25 0x00005555555af01e in opfunc_call (frame_ctx_p=0x7fffffffd8c0) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#26 0x00005555555b40ed in vm_execute (frame_ctx_p=0x7fffffffd8c0, arg_p=0x7fffffffdb24, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#27 0x00005555555b4375 in vm_run (bytecode_header_p=0x55555584cf20 <jerry_global_heap+4736>, this_binding_value=27, 
    lex_env_p=0x55555584c928 <jerry_global_heap+3208>, is_eval_code=false, arg_list_p=0x7fffffffdb24, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#28 0x000055555559e331 in ecma_op_function_call (func_obj_p=0x55555584c240 <jerry_global_heap+1440>, this_arg_value=72, 
    arguments_list_p=0x7fffffffdb24, arguments_list_len=0)
    at iotjs/deps/jerry/jerry-core/ecma/operations/ecma-function-object.c:406
#29 0x00005555555af01e in opfunc_call (frame_ctx_p=0x7fffffffdb60) at iotjs/deps/jerry/jerry-core/vm/vm.c:425
#30 0x00005555555b40ed in vm_execute (frame_ctx_p=0x7fffffffdb60, arg_p=0x0, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2793
#31 0x00005555555b4375 in vm_run (bytecode_header_p=0x55555584c368 <jerry_global_heap+1736>, this_binding_value=27, 
    lex_env_p=0x55555584bcc8 <jerry_global_heap+40>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:2873
#32 0x00005555555aec7c in vm_run_global (bytecode_p=0x55555584c368 <jerry_global_heap+1736>)
    at iotjs/deps/jerry/jerry-core/vm/vm.c:232
#33 0x0000555555580423 in jerry_run (func_val=1427) at iotjs/deps/jerry/jerry-core/api/jerry.c:558
#34 0x000055555556de3a in iotjs_jhelper_eval (name=0x5555556023c8 "iotjs.js", name_len=8, 
    data=0x55555560fcc0 <iotjs_s> "/* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance w"..., size=4256, strict_mode=false, 
    throws=0x7fffffffdd13) at iotjs/src/iotjs_binding.c:346
#35 0x000055555556c86d in iotjs_run (env=0x55555584a440 <current_env>) at iotjs/src/iotjs.c:100
#36 0x000055555556c92b in iotjs_start (env=0x55555584a440 <current_env>) at iotjs/src/iotjs.c:138
#37 0x000055555556cce8 in iotjs_entry (argc=2, argv=0x7fffffffdec8) at iotjs/src/iotjs.c:218
#38 0x000055555556c4ca in main (argc=2, argv=0x7fffffffdec8) at iotjs/iotjs_linux.c:19

Found by Fuzzinator with grammarinator

@knightburton knightburton self-assigned this Dec 7, 2017
yichoi pushed a commit that referenced this issue Dec 12, 2017
The path argument in the process.readSource must point
to an existing file, not a directory.
Fix #1351

IoT.js-DCO-1.0-Signed-off-by: Imre Kiss [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants