issue_owner_repo
sequencelengths 2
2
| issue_body
stringlengths 0
261k
⌀ | issue_title
stringlengths 1
925
| issue_comments_url
stringlengths 56
81
| issue_comments_count
int64 0
2.5k
| issue_created_at
stringlengths 20
20
| issue_updated_at
stringlengths 20
20
| issue_html_url
stringlengths 37
62
| issue_github_id
int64 387k
2.46B
| issue_number
int64 1
127k
|
---|---|---|---|---|---|---|---|---|---|
[
"jerryscript-project",
"jerryscript"
] | Add windows support for Jerryscript | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2285/comments | 2 | 2018-04-17T07:38:02Z | 2018-04-26T22:28:06Z | https://github.com/jerryscript-project/jerryscript/issues/2285 | 314,940,135 | 2,285 |
|
[
"jerryscript-project",
"jerryscript"
] | I want to use jerryscript in iOS and Android, can I use jerryscript through referencing the source code? | Using jerryscript in Mobile Devices | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2284/comments | 4 | 2018-04-17T05:44:27Z | 2018-04-19T07:35:50Z | https://github.com/jerryscript-project/jerryscript/issues/2284 | 314,913,394 | 2,284 |
[
"jerryscript-project",
"jerryscript"
] | Add native ffi support in jerryscript. | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2283/comments | 9 | 2018-04-16T13:57:01Z | 2019-05-06T11:25:21Z | https://github.com/jerryscript-project/jerryscript/issues/2283 | 314,662,663 | 2,283 |
|
[
"jerryscript-project",
"jerryscript"
] | ```javascript
// Code
console.log(Date.now(), new Date().getTime())
// Result
1523002147782.884 1523002147782.886
// Expected
1523002147782 1523002147782
```
| Date.now() and new Date().getTime() returns fractions | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2272/comments | 1 | 2018-04-06T08:11:52Z | 2018-04-09T11:27:16Z | https://github.com/jerryscript-project/jerryscript/issues/2272 | 311,884,662 | 2,272 |
[
"jerryscript-project",
"jerryscript"
] | This [Travis build](https://travis-ci.org/jerryscript-project/jerryscript/jobs/361777717) failed for me while trying to download the Zephyr SDK. I wonder if you're seeing that a lot? I used to have that problem in ZJS but I solved it with Travis caching in this [pull request](https://github.com/intel/zephyr.js/commit/ce313765b829108a308edaf675d390752f29c80f).
If it had been that simple here I would have tried it and submitted a PR right away, but it looks like you'd need to edit `zephyr/Makefile.travis` as well as `.travis.yml` and I don't have time at the moment to look into this, so I wanted to make a note of it.
This also has the benefit of skipping the download most of the time, speeding up the Travis build a lot. So basically, if you do it like I did, you'd cache some directory that holds the SDK and then check to see if it already contains the right version before you bother to download it with `wget` in the Makefile.
I'd also suggest parameterizing the Zephyr build version like we've done in ZJS to make it easier to update.
I intend to look at this someday myself but in case someone cares to beat me to it, here you go. :) | Suggest caching Zephyr SDK for Travis speed / success improvement | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2268/comments | 3 | 2018-04-03T20:45:06Z | 2019-01-12T11:21:50Z | https://github.com/jerryscript-project/jerryscript/issues/2268 | 310,992,130 | 2,268 |
[
"jerryscript-project",
"jerryscript"
] | I realize this is not a JerryScript specific question, but I was wondering what people's approaches are towards dealing with strings from JS when they have a `\u0000` unicode code point(s) in them. This ends up being encoded as a `0x00` byte, which happens to be the "terminator" of a C string as well.
I can imagine this being a source of bugs, esp. if assumptions are made in the C code w.r.t. the length given by `jerry_get_(utf8_)string_length()` vs `strlen()`/`strlen_s()`.
Some approaches I can think of to deal with this:
- Don't use anything from `<string.h>`, instead use a proper utf8 library to deal with strings that only takes in string data in the form of a pointer + length.
- Truncate: just use the first `0x00` as the end and wipe all data after it just to be sure.
- ... | Question: dealing with \u0000 in strings from jerry_string_to_utf8_char_buffer / jerry_string_to_char_buffer | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2263/comments | 1 | 2018-04-03T08:49:23Z | 2020-05-26T13:56:22Z | https://github.com/jerryscript-project/jerryscript/issues/2263 | 310,746,859 | 2,263 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 79289714
Build command: ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --compile-flag=-g --jerry-libc=off --static-link=off --strip=off --system-allocator=on --linker-flag=-fuse-ld=gold --error-messages=on --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
JSON.stringify(10, Array)
```
Usually, stack-overflow issues happen due to recursive js calls which is expected.
However, this test case doesn't contain any explicit recursion, so it may uncover a real issue.
###### Backtrace:
```
ASAN:DEADLYSIGNAL
=================================================================
==30252==ERROR: AddressSanitizer: stack-overflow on address 0xff6cfee0 (pc 0xf7a9eb38 bp 0xff6d0308 sp 0xff6cfec0 T0)
#0 0xf7a9eb37 in malloc (/usr/lib32/libasan.so.4+0xe4b37)
#1 0x566a417b in jmem_heap_alloc_block_internal jerryscript/jerry-core/jmem/jmem-heap.c:324
#2 0x566a4248 in jmem_heap_gc_and_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:360
#3 0x566a431d in jmem_heap_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:406
#4 0x56680b7d in ecma_alloc_property_pair jerryscript/jerry-core/ecma/base/ecma-alloc.c:240
#5 0x566c3138 in ecma_create_property jerryscript/jerry-core/ecma/base/ecma-helpers.c:452
#6 0x566c3809 in ecma_create_named_data_property jerryscript/jerry-core/ecma/base/ecma-helpers.c:538
#7 0x5669836b in ecma_op_general_object_define_own_property jerryscript/jerry-core/ecma/operations/ecma-objects-general.c:353
#8 0x566d4e80 in ecma_op_array_object_define_own_property jerryscript/jerry-core/ecma/operations/ecma-array-object.c:313
#9 0x5669bfed in ecma_op_object_define_own_property jerryscript/jerry-core/ecma/operations/ecma-objects.c:1133
#10 0x566cd821 in ecma_builtin_helper_def_prop jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c:682
#11 0x566d44f0 in ecma_op_create_array_object jerryscript/jerry-core/ecma/operations/ecma-array-object.c:120
#12 0x5668befb in ecma_builtin_array_dispatch_construct jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-array.c:101
#13 0x5668be94 in ecma_builtin_array_dispatch_call jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-array.c:87
#14 0x566d0679 in ecma_builtin_dispatch_call jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:915
#15 0x5669277b in ecma_op_function_call jerryscript/jerry-core/ecma/operations/ecma-function-object.c:439
#16 0x566582b7 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1331
#17 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#18 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#19 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#20 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#21 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#22 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#23 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#24 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#25 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#26 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
...
#227 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#228 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#229 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#230 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#231 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#232 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#233 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#234 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#235 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#236 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#237 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#238 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#239 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#240 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#241 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#242 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#243 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#244 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#245 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#246 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#247 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
#248 0x56658840 in ecma_builtin_json_str jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1425
#249 0x56659a85 in ecma_builtin_json_array jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:1688
SUMMARY: AddressSanitizer: stack-overflow (/usr/lib32/libasan.so.4+0xe4b37) in malloc
==30252==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) </sup>
| stack-overflow in ecma_builtin_json_array | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2258/comments | 2 | 2018-03-28T09:12:05Z | 2019-01-16T08:35:25Z | https://github.com/jerryscript-project/jerryscript/issues/2258 | 309,282,202 | 2,258 |
[
"jerryscript-project",
"jerryscript"
] | I would like to nominate Robert Sipka to become a JerryScript reviewer. I trust him to follow our process. He has already nearly 60 informal reviews:
#2250 Improve jerry_is_feature_enabled with object availability information
#2245 Move the sleep function to jerry-port
#2243 Add json parse and stringify function to jerryscript c api
#2235 Eliminate early memory deallocations in case of NuttX and TizenRT
#2234 Remove ecma_get_length_string
#2225 Fix build failure of NuttX tool
#2223 Travis CI - Put the NuttX/STM32F4 job to the allowed failures section
#2218 Reduce the memory footprint of 'ecma_instantiate_builtin'
#2216 Removed 'is_static' parameter from 'BUILTIN' macro, because was never used.
#2215 Negative tests
#2207 Multiple nexts with one command
#2208 Fix '--cmake-param' option of the build script.
#2206 Update the webpage
#2201 Fix buffer overrun while parsing malformed JSON hex escape sequence
#2171 Print the return value of the engine in case of TizenRT.
#2169 Change '{' regex parsing to work similarly to other engines
#2168 Fix the endianness of EPS8266 system
#2167 Update the webpage
#2166 Add version fields for debugger configuration
#2164 Modify the build method of TizenRT target
#2161 Introduce the Array Buffer C API
#2157 Fix random number generation on ESP8266
#2155 Update Zephyr RTOS port for Zephyr 1.10 release
#2154 Modify the build method of NuttX target
#1994 Fix for toFixed method
#1825 Add `setjmp` and `longjmp` functions for tizenrt-artik05x
#1822 Use external handlers in tizenrt-artik05x target
#1817 Increase verbosity when breakpoints not found in HTML (JavaScript) Debugger client
#1816 Include jerry-ext/handler only in nuttx-stm32f4 target
#1767 Merge `lit-unicode-*.inc.h`-related generator scripts
#1753 Support ECMAScript stopping in JerryScript
#1712 Add GitHub ribbon to header.html
#1704 Fix several pylint warning in debugger python client
#1703 Bug fix for the debugger python client 'quit' command
#1687 Rename 'CONFIG_DISABLE_ARRAYBUFFER_BUILTIN' to 'CONFIG_DISABLE_ES2015_ARRAYBUFFER_BUILTIN'
#1682 Update the webpage
#1668 Style fix: return value comments
#1659 Fix several pylint warnings
#1651 Fix old-style function definitions
#1628 Add delete all breakpoints feature to debugger (javascript)
#1599 Add a port setting to build script
#1576 Add new input validator API functions
#1557 Initial version of JerryScript debugger
#1532 [ES2015][TypedArray] Add other 8 types
#1527 target: zephyr: Switch to MinSizeRel build type following mainline
#1525 Update macro definitions in Curie-BSP target
#1521 Update the webpage
#1506 [API] Improve the performance of the external magic id search
#1505 Isolate GCC specific code
#1503 Fix test-api.c
#1483 Add #if control around GCC builtin functions so that the code can be compiled using non-GCC compilers
#1476 Add feature to remove parser
#1338 Improve the linking of libraries
#1232 Adapted the makefiles to the new build system
#1212 Initial refactoring of the code to match the latest API
#1209 Fix RIOT port after API update
#1175 Update the API changes in mbed targets
#989 Add stm32f4 board to the targets
Seconds are welcome. | Nominating Robert Sipka (robertsipka) to become a reviewer | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2254/comments | 6 | 2018-03-27T09:23:21Z | 2018-04-04T14:39:56Z | https://github.com/jerryscript-project/jerryscript/issues/2254 | 308,888,362 | 2,254 |
[
"jerryscript-project",
"jerryscript"
] | The following is some sample code which I hope helps demonstrates the problem.
```
typedef struct {
jerry_value_t val;
} FooBar;
static void free_ctx_cb(void *native_p) {
FooBar *ctx = (FooBar *) native_p;
jerry_release_value(ctx->val);
free(ctx);
}
static const jerry_object_native_info_t native_info = {
.free_cb = free_ctx_cb,
};
jerry_value_t my_func(const jerry_value_t function_obj_p,
const jerry_value_t this_val,
const jerry_value_t argv[],
const jerry_length_t argc) {
jerry_value_t obj = jerry_create_object();
FooBar *ctx = malloc(sizeof(FooBar));
ctx->val = jerry_acquire_value(this_val);
jerry_set_object_native_pointer(obj, (void *) ctx, &native_info);
return obj;
}
```
To finish my program I call `jerry_cleanup()`. This triggers garbage collection, which causes `free_ctx_cb()` to be run. `free_ctx_cb()` decrements the ref count on the variable, but the garbage collection alg doesn't seem to be aware of this new deref, so I get the following: `jerry_assert_fail(assertion="JERRY_CONTEXT (jmem_heap_allocated_size) == 0")`
To work around this I have to call `jerry_gc(); jerry_cleanup();`, but as you can imagine that only works for 1 layer. There could hypothetically be multiple more layers.
Am I using the APIs incorrectly, or should there be another loop in the garbage collection algorithm to pick up any new objects with a ref count of 0? | Garbage collection doesn't free values released during garbage collection (via native pointers) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2253/comments | 10 | 2018-03-26T14:43:43Z | 2020-06-12T13:51:30Z | https://github.com/jerryscript-project/jerryscript/issues/2253 | 308,602,625 | 2,253 |
[
"jerryscript-project",
"jerryscript"
] | (Sorry about my bad english)
Hello I build JerryScript with CodeBlocks for Windows and Linux and Raspberry PI 32/ 64-bit
With support for double "-d" and float "-f" so the resulting libs are:
JerryScript-32-f.dll, JerryScript-32-d.dll, JerryScript-64-f.dll, JerryScript-64-d.dll
libJerryScript-32-f.so, libJerryScript-32-d.so, libJerryScript-64-f.so, libJerryScript-64-d.so
Of course for the FLOAT32 build I disabled the JS date functionality and it works all so far.
But I wonder me that jerry_create_value and jerry_get_value are hard coded for "double" ?
I mean if I build JerryScript for my retro computer I have only float my retro compiler
don't have the data type double at all.
So why does JerryScript use double if
(CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32)
are defined ?
Thank you DJ
| float vs double | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2251/comments | 4 | 2018-03-24T08:52:46Z | 2018-11-06T11:21:14Z | https://github.com/jerryscript-project/jerryscript/issues/2251 | 308,241,047 | 2,251 |
[
"jerryscript-project",
"jerryscript"
] | fn_expr = function NaN(a){
'use strict';
NaN(0);
}
fn_expr(1);
==1318==ERROR: AddressSanitizer: stack-overflow on address 0xff769fec (pc 0xf7ab9c45 bp 0xf7b0f000 sp 0xff769fe0 T0)
#0 0xf7ab9c44 (/usr/lib32/libasan.so.2+0xb0c44)
#1 0xf7ab9757 (/usr/lib32/libasan.so.2+0xb0757)
#2 0xf7a246d2 (/usr/lib32/libasan.so.2+0x1b6d2)
#3 0xf7a9fdbb in malloc (/usr/lib32/libasan.so.2+0x96dbb)
#4 0x804f544 in jmem_heap_alloc_block_internal /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:324
#5 0x804f544 in jmem_heap_gc_and_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:360
#6 0x804f544 in jmem_heap_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:406
#7 0x808d5fc in ecma_create_object /home/b/jerryscript/jerry-core/ecma/base/ecma-helpers.c:99
#8 0x80d3d01 in ecma_op_create_function_object /home/b/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:127
#9 0x8135055 in vm_construct_literal_object /home/b/jerryscript/jerry-core/vm/vm.c:313
#10 0x8135055 in vm_init_loop /home/b/jerryscript/jerry-core/vm/vm.c:637
#11 0x8135055 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2831
#12 0x81388ef in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
#13 0x80d4a53 in ecma_op_function_call /home/b/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:405
#14 0x8136396 in opfunc_call /home/b/jerryscript/jerry-core/vm/vm.c:417
#15 0x8136396 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2844
#16 0x81388ef in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
#17 0x80d4a53 in ecma_op_function_call /home/b/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:405
#18 0x8136396 in opfunc_call /home/b/jerryscript/jerry-core/vm/vm.c:417
#19 0x8136396 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2844
#20 0x81388ef in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
#21 0x80d4a53 in ecma_op_function_call /home/b/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:405
#22 0x8136396 in opfunc_call /home/b/jerryscript/jerry-core/vm/vm.c:417
#23 0x8136396 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2844
#24 0x81388ef in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
#25 0x80d4a53 in ecma_op_function_call /home/b/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:405
#26 0x8136396 in opfunc_call /home/b/jerryscript/jerry-core/vm/vm.c:417
#27 0x8136396 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2844
#28 0x81388ef in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
#29 0x80d4a53 in ecma_op_function_call /home/b/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:405
#30 0x8136396 in opfunc_call /home/b/jerryscript/jerry-core/vm/vm.c:417
#31 0x8136396 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2844
#32 0x81388ef in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
........ | stack-overflow(recursion) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2238/comments | 3 | 2018-03-11T05:54:56Z | 2019-10-16T15:02:35Z | https://github.com/jerryscript-project/jerryscript/issues/2238 | 304,133,091 | 2,238 |
[
"jerryscript-project",
"jerryscript"
] | (new RegExp("[\\u0020")).exec("u");
=================================================================
==30634==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf600075f at pc 0x080ff179 bp 0xffe3dc58 sp 0xffe3dc48
READ of size 1 at 0xf600075f thread T0
#0 0x80ff178 in lit_read_code_unit_from_utf8 /home/b/jerryscript/jerry-core/lit/lit-strings.c:409
#1 0x80ff178 in lit_utf8_peek_next /home/b/jerryscript/jerry-core/lit/lit-strings.c:500
#2 0x811e0c0 in re_parse_char_class /home/b/jerryscript/jerry-core/parser/regexp/re-parser.c:437
#3 0x811a7b5 in re_parse_alternative /home/b/jerryscript/jerry-core/parser/regexp/re-compiler.c:399
#4 0x811b5f7 in re_compile_bytecode /home/b/jerryscript/jerry-core/parser/regexp/re-compiler.c:564
#5 0x80e2057 in ecma_op_create_regexp_object /home/b/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:292
#6 0x80bf83b in ecma_builtin_regexp_dispatch_construct /home/b/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c:136
#7 0x80a0e9d in ecma_builtin_dispatch_construct /home/b/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:154
#8 0x81358b3 in opfunc_construct /home/b/jerryscript/jerry-core/vm/vm.c:475
#9 0x81358b3 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2849
#10 0x8137a0d in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
#11 0x8137a0d in vm_run_global /home/b/jerryscript/jerry-core/vm/vm.c:224
#12 0x8057509 in jerry_run /home/b/jerryscript/jerry-core/api/jerry.c:562
#13 0x804c176 in main /home/b/jerryscript/jerry-main/main-unix.c:611
#14 0xf77ea636 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18636)
#15 0x804f8e9 (/home/b/jerryscript/build/bin/jerry+0x804f8e9)
0xf600075f is located 0 bytes to the right of 15-byte region [0xf6000750,0xf600075f)
allocated by thread T0 here:
#0 0xf7a1edee in malloc (/usr/lib32/libasan.so.2+0x96dee)
#1 0x804f544 in jmem_heap_alloc_block_internal /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:324
#2 0x804f544 in jmem_heap_gc_and_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:360
#3 0x804f544 in jmem_heap_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:406
#4 0x80650aa in ecma_new_ecma_string_from_utf8 /home/b/jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:232
#5 0x807d593 in ecma_find_or_create_literal_string /home/b/jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:73
#6 0x810487a in parser_compute_indicies /home/b/jerryscript/jerry-core/parser/js/js-parser.c:201
#7 0x810487a in parser_post_processing /home/b/jerryscript/jerry-core/parser/js/js-parser.c:1441
#8 0x8110f8a in parser_parse_source /home/b/jerryscript/jerry-core/parser/js/js-parser.c:2267
#9 0x8112c78 in parser_parse_script /home/b/jerryscript/jerry-core/parser/js/js-parser.c:2764
#10 0x8056f72 in jerry_parse /home/b/jerryscript/jerry-core/api/jerry.c:388
#11 0x8056f72 in jerry_parse_named_resource /home/b/jerryscript/jerry-core/api/jerry.c:446
#12 0x804c140 in main /home/b/jerryscript/jerry-main/main-unix.c:602
#13 0xf77ea636 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18636)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/b/jerryscript/jerry-core/lit/lit-strings.c:409 lit_read_code_unit_from_utf8
Shadow bytes around the buggy address:
0x3ec00090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ec000a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ec000b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ec000c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ec000d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x3ec000e0: fa fa 00 01 fa fa 00 00 fa fa 00[07]fa fa fd fa
0x3ec000f0: fa fa 00 05 fa fa 00 02 fa fa 00 06 fa fa 00 00
0x3ec00100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ec00110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ec00120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ec00130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
==30634==ABORTING
| heap-buffer-overflow in lit_read_code_unit_from_utf8 | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2237/comments | 7 | 2018-03-08T07:44:13Z | 2018-05-28T08:13:19Z | https://github.com/jerryscript-project/jerryscript/issues/2237 | 303,385,238 | 2,237 |
[
"jerryscript-project",
"jerryscript"
] | Remove this old function, and use the regular get magic string. | Remove ecma_get_length_string | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2231/comments | 0 | 2018-03-01T12:24:44Z | 2018-03-05T14:17:32Z | https://github.com/jerryscript-project/jerryscript/issues/2231 | 301,385,653 | 2,231 |
[
"jerryscript-project",
"jerryscript"
] | ((new RegExp("[\\u0")).exec("u"));
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
build command:
python ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --jerry-libc=off --static-link=off --lto=off --error-message=on --system-allocator=on
=================================================================
==9567==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf580075c at pc 0x080f9f5a bp 0xffdf2a48 sp 0xffdf2a38
READ of size 1 at 0xf580075c thread T0
#0 0x80f9f59 in lit_read_code_unit_from_hex /home/b/jerryscript/jerry-core/lit/lit-char-helpers.c:443
#1 0x811df42 in re_parse_char_class /home/b/jerryscript/jerry-core/parser/regexp/re-parser.c:431
#2 0x811a7b5 in re_parse_alternative /home/b/jerryscript/jerry-core/parser/regexp/re-compiler.c:399
#3 0x811b5f7 in re_compile_bytecode /home/b/jerryscript/jerry-core/parser/regexp/re-compiler.c:564
#4 0x80e2057 in ecma_op_create_regexp_object /home/b/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:292
#5 0x80bf83b in ecma_builtin_regexp_dispatch_construct /home/b/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c:136
#6 0x80a0e9d in ecma_builtin_dispatch_construct /home/b/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:154
#7 0x81358b3 in opfunc_construct /home/b/jerryscript/jerry-core/vm/vm.c:475
#8 0x81358b3 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2849
#9 0x8137a0d in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2924
#10 0x8137a0d in vm_run_global /home/b/jerryscript/jerry-core/vm/vm.c:224
#11 0x8057509 in jerry_run /home/b/jerryscript/jerry-core/api/jerry.c:562
#12 0x804c176 in main /home/b/jerryscript/jerry-main/main-unix.c:611
#13 0xf7005636 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18636)
#14 0x804f8e9 (/home/b/jerryscript/build/bin/jerry+0x804f8e9)
0xf580075c is located 0 bytes to the right of 12-byte region [0xf5800750,0xf580075c)
allocated by thread T0 here:
#0 0xf7239dee in malloc (/usr/lib32/libasan.so.2+0x96dee)
#1 0x804f544 in jmem_heap_alloc_block_internal /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:324
#2 0x804f544 in jmem_heap_gc_and_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:360
#3 0x804f544 in jmem_heap_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:406
#4 0x80650aa in ecma_new_ecma_string_from_utf8 /home/b/jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:232
#5 0x807d593 in ecma_find_or_create_literal_string /home/b/jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:73
#6 0x810487a in parser_compute_indicies /home/b/jerryscript/jerry-core/parser/js/js-parser.c:201
#7 0x810487a in parser_post_processing /home/b/jerryscript/jerry-core/parser/js/js-parser.c:1441
#8 0x8110f8a in parser_parse_source /home/b/jerryscript/jerry-core/parser/js/js-parser.c:2267
#9 0x8112c78 in parser_parse_script /home/b/jerryscript/jerry-core/parser/js/js-parser.c:2764
#10 0x8056f72 in jerry_parse /home/b/jerryscript/jerry-core/api/jerry.c:388
#11 0x8056f72 in jerry_parse_named_resource /home/b/jerryscript/jerry-core/api/jerry.c:446
#12 0x804c140 in main /home/b/jerryscript/jerry-main/main-unix.c:602
#13 0xf7005636 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18636)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/b/jerryscript/jerry-core/lit/lit-char-helpers.c:443 lit_read_code_unit_from_hex
Shadow bytes around the buggy address:
0x3eb00090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eb000a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eb000b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eb000c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eb000d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x3eb000e0: fa fa 00 01 fa fa 00 00 fa fa 00[04]fa fa fd fa
0x3eb000f0: fa fa 00 05 fa fa 00 02 fa fa 00 06 fa fa 00 00
0x3eb00100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eb00110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eb00120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eb00130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
==9567==ABORTING
| heap-buffer-overflow in lit_read_code_unit_from_hex | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2230/comments | 6 | 2018-03-01T06:28:57Z | 2018-05-28T08:13:19Z | https://github.com/jerryscript-project/jerryscript/issues/2230 | 301,292,164 | 2,230 |
[
"jerryscript-project",
"jerryscript"
] | The current debugger only works on Linux's BSD socket, I am trying to get the debugger to work on Zephyr since it recently added BSD socket support. However, it has slightly different headers for using the socket library and also it currently only supports a subset of the API. It would be nice if we can decouple all those socket APIs like accept(), send(), recv() and sleep() into jerry_port APIs as they can be platform-dependent. Are there any plans to add debugger support for other platforms?
Here's the working here, basically I replaced the debugger-ws.c with my own debugger-ws-zephyr.c when building for Zephyr:
https://github.com/jimmy-huang/jerryscript/tree/js-debugger | Add debugger support with other platforms | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2229/comments | 9 | 2018-03-01T00:06:24Z | 2018-11-06T11:19:27Z | https://github.com/jerryscript-project/jerryscript/issues/2229 | 301,231,402 | 2,229 |
[
"jerryscript-project",
"jerryscript"
] | The following commit in NuttX tools cause a build failure on the Travis CI: https://bitbucket.org/nuttx/tools/commits/164450f982b404fdc2b3233db51dc3eaa1f08b7f
**output:**
```
make -C ../tools/kconfig-frontends
make[1]: Entering directory `/home/travis/build/jerryscript-project/tools/kconfig-frontends'
/home/travis/build/jerryscript-project/tools/kconfig-frontends/scripts/.autostuff/scripts/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
make[1]: *** [aclocal.m4] Error 127
make[1]: Leaving directory `/home/travis/build/jerryscript-project/tools/kconfig-frontends'
make: *** [install-kconfig] Error 2
``` | Fix the Nuttx build on Travis CI | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2224/comments | 0 | 2018-02-26T14:01:36Z | 2018-02-27T09:12:06Z | https://github.com/jerryscript-project/jerryscript/issues/2224 | 300,249,448 | 2,224 |
[
"jerryscript-project",
"jerryscript"
] | It would be good to release JerryScript 2.0 this year. No specific deadline so far.
What we should do before that is reworking the API. Some ideas:
- delete obsolote functions
- rework error flag to be an error value (error can only be a result of something, and cannot be used as input except unboxing its value). | JerryScript 2.0 | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2213/comments | 23 | 2018-02-20T07:21:14Z | 2019-08-04T10:49:26Z | https://github.com/jerryscript-project/jerryscript/issues/2213 | 298,493,894 | 2,213 |
[
"jerryscript-project",
"jerryscript"
] | Hello JerryScript,
I have a little question. :)
I'm comparing embeddable javascript engines. I need a js engine which is available on linux, macos, android, ios and windows.
I cannot see windows support now. Is it in progress or is it planned? | Windows port | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2211/comments | 19 | 2018-02-17T20:02:02Z | 2022-01-27T11:45:48Z | https://github.com/jerryscript-project/jerryscript/issues/2211 | 298,032,112 | 2,211 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: d7991ae5
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
new RegExp("\{{91406,456}");
```
###### Backtrace:
```
ICE: Assertion 'qmin <= qmax' failed at jerryscript/jerry-core/parser/regexp/re-compiler.c(re_insert_simple_iterator):66.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x000000000046dec6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x000000000046dec6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040ccc0 in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:98
#2 0x000000000040cc92 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000405feb in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x0000000000450c2c in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x0000000000450c7e in jerry_assert_fail (assertion=0x4758b9 "qmin <= qmax",
file=0x474ce8 "jerryscript/jerry-core/parser/regexp/re-compiler.c",
function=0x47fb70 <__func__.3838.lto_priv.330> "re_insert_simple_iterator", line=66)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x0000000000438b92 in re_insert_simple_iterator (re_ctx_p=0x7fffffffd720, new_atom_start_offset=1)
at jerryscript/jerry-core/parser/regexp/re-compiler.c:66
#7 0x0000000000439177 in re_parse_alternative (re_ctx_p=0x7fffffffd720, expect_eof=true)
at jerryscript/jerry-core/parser/regexp/re-compiler.c:276
#8 0x00000000004399ad in re_compile_bytecode (out_bytecode_p=0x7fffffffd7a0, pattern_str_p=0x68e448 <jerry_global_heap+520>, flags=0)
at jerryscript/jerry-core/parser/regexp/re-compiler.c:560
#9 0x00000000004132b4 in ecma_op_create_regexp_object (pattern_p=0x68e448 <jerry_global_heap+520>, flags_str_p=0x0)
at jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:292
#10 0x00000000004320f4 in ecma_builtin_regexp_dispatch_construct (arguments_list_p=0x7fffffffd9c4, arguments_list_len=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c:136
#11 0x0000000000447092 in ecma_builtin_dispatch_construct (obj_p=0x68e310 <jerry_global_heap+208>, arguments_list_p=0x7fffffffd9c4,
arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:171
#12 0x000000000044a448 in ecma_op_function_construct (func_obj_p=0x68e310 <jerry_global_heap+208>, arguments_list_p=0x7fffffffd9c4,
arguments_list_len=1) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:648
#13 0x000000000043bb8d in opfunc_construct (frame_ctx_p=0x7fffffffda00) at jerryscript/jerry-core/vm/vm.c:483
#14 0x0000000000440ab9 in vm_execute (frame_ctx_p=0x7fffffffda00, arg_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2876
#15 0x0000000000440cfe in vm_run (bytecode_header_p=0x68e468 <jerry_global_heap+552>, this_binding_value=27,
lex_env_p=0x68e268 <jerry_global_heap+40>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2951
#16 0x000000000043b6e0 in vm_run_global (bytecode_p=0x68e468 <jerry_global_heap+552>)
at jerryscript/jerry-core/vm/vm.c:232
#17 0x0000000000453dbc in jerry_run (func_val=195) at jerryscript/jerry-core/api/jerry.c:561
#18 0x0000000000452964 in main (argc=3, argv=0x7fffffffdd28) at jerryscript/jerry-main/main-unix.c:611
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'qmin <= qmax' failed in re_insert_simple_iterator | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2204/comments | 1 | 2018-02-13T16:23:52Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/2204 | 296,799,049 | 2,204 |
[
"jerryscript-project",
"jerryscript"
] | Right now there are [2 debugger client implementations]: 1) a CLI client written in python 2) a browser based client written in HTML/JS.
Both re-implement similar thing. Both are written in ways that make it hard to reuse pieces of the code in other contexts, mainly because they are written as large, monolithic blobs of code.
During the last [JerryScript Workshop] in the Fall of 2017, we talked about the desire to be able to leverage existing JS debugger infastructure, to avoid re-inventing the wheel and re-creating the functionality that already exists in existing debugger clients such as IDEs.
I think the first stepping stone towards that goal is to rewrite/refactor the existing debugger client code into a re-usable library that other tools can be built on top of (a CLI interface being one of them).
In terms of language of choice, we would like write this library in TypeScript because of the many advantages a typed language gives and because it transpiles into JS and can therefore easily be run inside Node.js (for CLI tooling), inside a browser or even inside JerryScript itself ;)
When written in TS/JS, this libary can be published to npm, to make it easy to consume the library as well.
I imagine to build this library alongside the existing clients and as soon as the library is "at par" with the existing clients, rework the existing clients to make use of the library. At that point, the `jerry-client-ws.py` would be replaced with a tiny Node.js program that wraps the libary and implements the CLI.
## Questions
### What does the core team think of this idea?
### Are there any major changes / extensions to the protocol planned?
### Where would the sources of the library live / what is the development repo?
In my opinion, it would be easiest if the sources for this library live in the main `jerryscript` project. That way, any changes that affect the client and server sides can be reviewed in a single PR. From a CI/testing point of view, this is also the simplest set up.
That said, how to manage PRs / reviews and make sure we can move fast? I am not sure if the JerryScript core team is comfortable reviewing TypeScript code. Assuming that the people writing the code will mostly be me / my coworkers and not people from the JerryScript core team: we don't want to loose development velocity because the code that gets written doesn't get reviewed and approved in a timely manner.
An alternative approach could be to develop initially in a different repo (under our control) and contribute it back "wholesale" at once (and potentially deprecate that different repo after that point).
[JerryScript Workshop]: https://os.mbed.com/blog/entry/JerryScript-workshop-2017/
[2 debugger client implementations]: https://github.com/jerryscript-project/jerryscript/tree/master/jerry-debugger | [Discussion] Refactor jerry-client-ws.html/py into reusable library | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2203/comments | 8 | 2018-02-12T16:08:39Z | 2018-05-24T08:55:16Z | https://github.com/jerryscript-project/jerryscript/issues/2203 | 296,430,508 | 2,203 |
[
"jerryscript-project",
"jerryscript"
] | Jerry version:
Checked revision: `e8608707b6d9486022b4d72b280303923945fdeb`
Build command: `./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --compile-flag=-g --jerry-libc=off --static-link=off --strip=off --system-allocator=on --error-messages=on --profile=es2015-subset`
OS:
macOS 10.12.6 (16G1212)
Test case:
```
JSON.parse('"\\ubad');
```
Backtrace:
```
==8770==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x0240155e at pc 0x001850dc bp 0xbffb4418 sp 0xbffb4414
READ of size 1 at 0x0240155e thread T0
#0 0x1850db in lit_read_code_unit_from_hex lit-char-helpers.c:443
#1 0x1e5412 in ecma_builtin_json_parse_string ecma-builtin-json.c:195
#2 0x1e3821 in ecma_builtin_json_parse_next_token ecma-builtin-json.c:450
#3 0x1e1fcb in ecma_builtin_json_parse_value ecma-builtin-json.c:565
#4 0x10cdce in ecma_builtin_json_parse ecma-builtin-json.c:837
#5 0x10c5cb in ecma_builtin_json_dispatch_routine ecma-builtin-json.inc.h:26
#6 0x13d396 in ecma_builtin_dispatch_routine ecma-builtins.inc.h:135
#7 0x13caff in ecma_builtin_dispatch_call ecma-builtins.c:844
#8 0x7e3af in ecma_op_function_call ecma-function-object.c:342
#9 0x22181f in opfunc_call vm.c:425
#10 0x1dbd77 in vm_execute vm.c:2871
#11 0x1572c4 in vm_run vm.c:2951
#12 0x7e8df in ecma_op_function_call ecma-function-object.c:405
#13 0x22181f in opfunc_call vm.c:425
#14 0x1dbd77 in vm_execute vm.c:2871
#15 0x1572c4 in vm_run vm.c:2951
#16 0x55f82 in vm_run_global vm.c:232
#17 0x53dc1 in jerry_run jerry.c:562
#18 0x4d58f in main main-unix.c:611
#19 0xa153c394 in start (libdyld.dylib:i386+0x5394)
0x0240155e is located 0 bytes to the right of 14-byte region [0x02401550,0x0240155e)
allocated by thread T0 here:
#0 0x64752c in wrap_malloc (libclang_rt.asan_osx_dynamic.dylib:i386+0x5452c)
#1 0x1fb416 in jmem_heap_alloc_block_internal jmem-heap.c:324
#2 0x18450a in jmem_heap_gc_and_alloc_block jmem-heap.c:360
#3 0x5e80e in ecma_new_ecma_string_from_utf8 jmem-heap.c:406
#4 0xd3605 in ecma_find_or_create_literal_string ecma-literal-storage.c:73
#5 0x202118 in parser_compute_indicies js-parser.c:201
#6 0x1c2ae3 in parser_post_processing js-parser.c:1424
#7 0x1c99ce in parser_parse_source js-parser.c:2229
#8 0x540d8 in parser_parse_script js-parser.c:2726
#9 0x5373d in jerry_parse jerry.c:388
#10 0x55575 in jerry_parse_named_resource jerry.c:446
#11 0x4d4a7 in main main-unix.c:602
#12 0xa153c394 in start (libdyld.dylib:i386+0x5394)
SUMMARY: AddressSanitizer: heap-buffer-overflow lit-char-helpers.c:443 in lit_read_code_unit_from_hex
Shadow bytes around the buggy address:
0x20480250: fa fa 00 04 fa fa 00 03 fa fa 00 03 fa fa 00 00
0x20480260: fa fa 00 02 fa fa 00 02 fa fa 00 02 fa fa 00 00
0x20480270: fa fa 00 06 fa fa 00 fa fa fa fd fd fa fa 00 05
0x20480280: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa fd fd
0x20480290: fa fa 00 00 fa fa 00 06 fa fa fd fa fa fa 00 06
=>0x204802a0: fa fa fd fd fa fa 00 00 fa fa 00[06]fa fa 00 03
0x204802b0: fa fa 00 03 fa fa 00 00 fa fa 00 01 fa fa 00 00
0x204802c0: fa fa 00 02 fa fa 00 00 fa fa 00 05 fa fa fd fa
0x204802d0: fa fa fd fd fa fa fd fa fa fa fd fd fa fa fd fd
0x204802e0: fa fa fd fd fa fa fd fd fa fa fd fa fa fa fd fd
0x204802f0: fa fa fd fd fa fa fd fa fa fa fd fd fa fa fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==8770==ABORTING
Abort trap: 6
``` | Heap buffer overflow while parsing malformed JSON hex escape sequence w/o closing quote | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2200/comments | 3 | 2018-02-10T13:24:45Z | 2018-02-16T08:02:04Z | https://github.com/jerryscript-project/jerryscript/issues/2200 | 296,100,625 | 2,200 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: e8608707
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
var id_0 = Object.prototype.toString ;
Object.prototype.toString = function ( ) { return "SHIFTED" } ;
RegExp ( '#1: __str = new String({}); typeof __str === "object". Actual: typeof __str ===');
```
###### Backtrace:
```
ICE: Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c(ecma_free_string_list):43.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0xf7fd5db9 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7fd5db9 in __kernel_vsyscall ()
#1 0xf7ca57e2 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xf7ca6f51 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0x082d09bc in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x081f9c67 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x081f9ce1 in jerry_assert_fail (assertion=0x8308aa0 <.str.2> "ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)",
file=0x83089c0 <.str.1> "jerryscript/jerry-core/ecma/base/ecma-literal-storage.c",
function=0x8308b00 <__func__.ecma_free_string_list> "ecma_free_string_list", line=43)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x081ba367 in ecma_free_string_list (string_list_p=0xf5f00710)
at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:43
#7 0x081ba187 in ecma_finalize_lit_storage () at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:60
#8 0x081b8b64 in ecma_finalize () at jerryscript/jerry-core/ecma/base/ecma-init-finalize.c:65
#9 0x08172db9 in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:222
#10 0x0816ef06 in main (argc=3, argv=0xffffcea4) at jerryscript/jerry-main/main-unix.c:763
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed in ecma_free_string_list | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2198/comments | 1 | 2018-02-08T09:04:03Z | 2018-02-19T07:57:46Z | https://github.com/jerryscript-project/jerryscript/issues/2198 | 295,432,733 | 2,198 |
[
"jerryscript-project",
"jerryscript"
] | I tried to run example on ubuntu 14.04. I got a demo.c
```
#include <string.h>
#include "jerryscript.h"
int
main (void)
{
const jerry_char_t script[] = "var str = 'Hello, World!';";
size_t script_size = strlen ((const char *) script);
bool ret_value = jerry_run_simple (script, script_size, JERRY_INIT_EMPTY);
return (ret_value ? 0 : 1);
}
```
then run
```
$ gcc -I/usr/local/include -L/usr/local/lib -o demo demo.c
demo.c:(.text+0x68): undefined reference to `jerry_run_simple'
collect2: error: ld returned 1 exit status
```
I have got `.h` and `.a` files in my `/use/local/include` and `/usr/local/lib` path. | [ERROR]when runing example, undefined reference to `jerry_run_simple' | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2193/comments | 8 | 2018-02-01T15:07:14Z | 2020-03-25T15:35:21Z | https://github.com/jerryscript-project/jerryscript/issues/2193 | 293,564,147 | 2,193 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 918eb22a
Build command: ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --compile-flag=-g --jerry-libc=off --static-link=off --strip=off --system-allocator=on --linker-flag=-fuse-ld=gold --error-messages=on --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
JSON.parse('"' + '\\u');
```
The test case is quite similar to #2180 but the failure happens in a different module.
The place and the type of the failure is the same as in #2140 but the test cases and the traces are completely different.
###### Backtrace:
```
=================================================================
==15239==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf5f0065b at pc 0x0822d726 bp 0xff814e78 sp 0xff814e6c
READ of size 1 at 0xf5f0065b thread T0
#0 0x822d725 in lit_read_code_unit_from_hex jerryscript/jerry-core/lit/lit-char-helpers.c:443:9
#1 0x82b7ae9 in ecma_builtin_json_parse_string jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:181:17
#2 0x82b5cf3 in ecma_builtin_json_parse_next_token jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:435:9
#3 0x82b477d in ecma_builtin_json_parse_value jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:550:3
#4 0x82b1ac7 in ecma_builtin_json_parse jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:822:31
#5 0x82b12a8 in ecma_builtin_json_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h:26:1
#6 0x81ecc14 in ecma_builtin_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:135:1
#7 0x81ebb55 in ecma_builtin_dispatch_call jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844:17
#8 0x82038f2 in ecma_op_function_call jerryscript/jerry-core/ecma/operations/ecma-function-object.c:342:19
#9 0x8277f73 in opfunc_call jerryscript/jerry-core/vm/vm.c:425:24
#10 0x825e906 in vm_execute jerryscript/jerry-core/vm/vm.c:2871:7
#11 0x825dc14 in vm_run jerryscript/jerry-core/vm/vm.c:2951:10
#12 0x825d0cf in vm_run_global jerryscript/jerry-core/vm/vm.c:232:28
#13 0x817673c in jerry_run jerryscript/jerry-core/api/jerry.c:559:24
#14 0x816ea31 in main jerryscript/jerry-main/main-unix.c:664:21
#15 0xf7c2d985 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18985)
#16 0x806fe97 in _start (jerryscript/build/bin/jerry+0x806fe97)
0xf5f0065b is located 0 bytes to the right of 11-byte region [0xf5f00650,0xf5f0065b)
allocated by thread T0 here:
#0 0x81334b4 in malloc (jerryscript/build/bin/jerry+0x81334b4)
#1 0x822a8f7 in jmem_heap_alloc_block_internal jerryscript/jerry-core/jmem/jmem-heap.c:324:10
#2 0x822a644 in jmem_heap_gc_and_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:360:24
#3 0x822a464 in jmem_heap_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:406:10
#4 0x8279927 in ecma_alloc_string_buffer jerryscript/jerry-core/ecma/base/ecma-alloc.c:182:10
#5 0x81b1049 in ecma_append_chars_to_string jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:621:21
#6 0x81b2db0 in ecma_concat_ecma_strings jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:738:10
#7 0x83504de in opfunc_addition jerryscript/jerry-core/vm/opcodes-ecma-arithmetics.c:154:17
#8 0x826be3d in vm_loop jerryscript/jerry-core/vm/vm.c:1722:20
#9 0x825e7c8 in vm_execute jerryscript/jerry-core/vm/vm.c:2862:24
#10 0x825dc14 in vm_run jerryscript/jerry-core/vm/vm.c:2951:10
#11 0x825d0cf in vm_run_global jerryscript/jerry-core/vm/vm.c:232:28
#12 0x817673c in jerry_run jerryscript/jerry-core/api/jerry.c:559:24
#13 0x816ea31 in main jerryscript/jerry-main/main-unix.c:664:21
#14 0xf7c2d985 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18985)
SUMMARY: AddressSanitizer: heap-buffer-overflow jerryscript/jerry-core/lit/lit-char-helpers.c:443:9 in lit_read_code_unit_from_hex
Shadow bytes around the buggy address:
0x3ebe0070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe0080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe0090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe00a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe00b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x3ebe00c0: fa fa fa fa fa fa fa fa fa fa 00[03]fa fa 00 00
0x3ebe00d0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 00
0x3ebe00e0: fa fa 00 02 fa fa fd fa fa fa 00 05 fa fa 00 02
0x3ebe00f0: fa fa 00 06 fa fa 00 00 fa fa fa fa fa fa fa fa
0x3ebe0100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe0110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==15239==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| heap-buffer-overflow in lit_read_code_unit_from_hex | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2192/comments | 0 | 2018-02-01T13:05:04Z | 2018-02-01T21:37:38Z | https://github.com/jerryscript-project/jerryscript/issues/2192 | 293,522,732 | 2,192 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 918eb22a
Build command: ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --compile-flag=-g --jerry-libc=off --static-link=off --strip=off --system-allocator=on --linker-flag=-fuse-ld=gold --error-messages=on --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
/(?:(?=x)){1000}xyz/.exec('xyz');
```
Usually, I do not report stack-overflows since they are due to recursive js calls mostly.
However, in this case the failure disappears if I remove either the positive lookahed or the non-capturing brackets.
So I leave to the experts to decide whether this is a feature or a bug.
###### Backtrace:
```
ASAN:DEADLYSIGNAL
=================================================================
==24793==ERROR: AddressSanitizer: stack-overflow on address 0xff0acfe8 (pc 0x080cead4 bp 0xff0ad448 sp 0xff0acfec T0)
#0 0x80cead3 in __interceptor_memcpy.part.43 (jerryscript/build/bin/jerry+0x80cead3)
#1 0x834eda7 in re_get_value jerryscript/jerry-core/parser/regexp/re-bytecode.c:157:3
#2 0x82fb7a5 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:947:19
#3 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#4 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#5 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#6 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#7 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#8 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#9 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#10 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#11 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#12 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#13 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#14 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#15 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#16 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#17 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#18 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#19 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#20 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#21 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#22 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#23 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#24 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#25 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#26 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#27 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#28 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#29 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#30 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#31 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#32 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#33 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#34 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#35 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#36 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#37 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#38 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#39 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#40 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#41 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#42 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#43 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#44 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#45 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#46 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#47 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#48 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#49 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#50 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#51 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#52 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#53 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#54 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#55 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#56 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#57 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#58 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#59 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#60 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#61 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#62 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#63 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#64 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#65 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#66 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#67 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#68 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#69 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#70 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#71 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#72 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#73 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#74 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#75 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#76 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#77 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#78 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#79 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#80 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#81 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#82 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#83 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#84 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#85 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#86 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#87 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#88 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#89 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#90 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#91 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#92 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#93 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#94 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#95 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#96 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#97 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#98 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#99 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#100 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#101 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#102 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#103 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#104 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#105 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#106 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#107 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#108 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#109 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#110 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#111 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#112 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#113 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#114 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#115 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#116 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#117 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#118 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#119 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#120 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#121 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#122 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#123 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#124 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#125 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#126 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#127 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#128 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#129 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#130 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#131 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#132 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#133 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#134 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#135 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#136 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#137 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#138 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#139 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#140 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#141 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#142 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#143 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#144 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#145 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#146 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#147 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#148 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#149 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#150 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#151 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#152 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#153 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#154 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#155 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#156 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#157 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#158 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#159 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#160 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#161 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#162 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#163 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#164 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#165 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#166 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#167 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#168 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#169 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#170 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#171 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#172 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#173 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#174 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#175 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#176 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#177 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#178 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#179 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#180 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#181 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#182 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#183 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#184 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#185 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#186 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#187 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#188 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#189 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#190 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#191 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#192 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#193 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#194 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#195 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#196 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#197 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#198 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#199 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#200 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#201 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#202 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#203 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#204 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#205 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#206 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#207 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#208 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#209 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#210 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#211 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#212 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#213 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#214 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#215 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#216 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#217 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#218 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#219 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#220 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#221 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#222 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#223 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#224 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#225 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#226 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#227 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#228 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#229 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#230 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#231 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#232 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#233 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#234 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#235 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#236 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#237 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#238 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#239 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#240 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#241 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#242 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#243 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#244 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#245 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
#246 0x82fc69e in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987:38
#247 0x82fd375 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1032:38
#248 0x82f5e53 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:565:27
#249 0x82f9fc1 in re_match_regexp jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:840:38
SUMMARY: AddressSanitizer: stack-overflow (jerryscript/build/bin/jerry+0x80cead3) in __interceptor_memcpy.part.43
==24793==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| stack-overflow in re_match_regexp | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2190/comments | 2 | 2018-02-01T12:18:46Z | 2019-01-17T19:16:51Z | https://github.com/jerryscript-project/jerryscript/issues/2190 | 293,509,616 | 2,190 |
[
"jerryscript-project",
"jerryscript"
] | I have the latest JerryScript from the master branch. And tried to do something that worked some time ago. Namely - execute a snapshot and from the snapshot call a function.
Here are the steps that I have used:
1. I have a `tests.js` with the following content
```js
function sysloop() {
// empty function...
};
print("main js OK");
```
2. I have compiled the `jerry-snapshot` binary using the minimal profile.
3. Then I created a snapshot using the command below:
```
./build/bin/jerry-snapshot generate -o tests.js.snap tests.js
```
Which produced a file with the following data in it:
```
00000000 4a 52 52 59 08 00 00 00 00 00 00 00 48 00 00 00 |JRRY........H...|
00000010 01 00 00 00 18 00 00 00 04 00 01 00 01 00 02 00 |................|
00000020 00 02 03 04 01 00 04 00 06 00 04 00 42 00 03 29 |............B..)|
00000030 01 02 bd 46 00 00 00 00 02 00 01 00 21 00 00 00 |...F........!...|
00000040 00 00 00 00 46 00 00 00 24 00 00 00 07 00 73 79 |....F...$.....sy|
00000050 73 6c 6f 6f 70 00 00 00 05 00 70 72 69 6e 74 00 |sloop.....print.|
00000060 0a 00 6d 61 69 6e 20 6a 73 20 4f 4b |..main js OK|
0000006c
```
5. After that I tried to load the snapshot and run a function from it using the code below:
```C
// check the arguments 1 - snapshotname, 2 - function to call
if(argc != 3) {
printf("Usage:\n\t%s <snapshot-file> <function-name>", argv[0]);
return 1;
}
// load the snapshot
const uint32_t *snapshot_p = read_file (fileName, &snapshotSize);
if (snapshot_p == NULL)
{
printf("Snapshot file load error");
return 2;
}
// Initialize the JS VM
jerry_init(JERRY_INIT_EMPTY);
// execute the snapshot
ret_value = jerry_exec_snapshot (snapshot_p, snapshotSize, true);
if (jerry_value_has_error_flag (ret_value))
{
jerry_release_value(ret_value);
printf("Unable to execute the snapshot");
return 3;
}
jerry_release_value(ret_value);
// run the function
jerry_value_t global_obj_val = jerry_get_global_object();
jerry_value_t prop_name_val = jerry_create_string((const jerry_char_t *) functionName);
jerry_value_t jsFunction = jerry_get_property(global_obj_val, prop_name_val);
jerry_release_value(prop_name_val);
if (jerry_value_has_error_flag(jsFunction)) {
debugf("Error: '%s' not defined!", functionName);
jerry_release_value(jsFunction);
jerry_release_value(global_obj_val);
return false;
}
if (!jerry_value_is_function(jsFunction)) {
debugf("Error: '%s' is not a function!", functionName);
jerry_release_value(jsFunction);
jerry_release_value(global_obj_val);
return 4;
}
int ret_code = 0;
jerry_value_t res = jerry_call_function(jsFunction, global_obj_val, NULL, 0);
if (jerry_value_has_error_flag(res)) {
ret_code = 5;
}
```
And the test C application above is compiled with the same flags as the minimal profile
```sh
gcc -std=c99 -Wall -Os -g -O2 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions \
-DCONFIG_DISABLE_BUILTINS -DCONFIG_DISABLE_ES2015 -DCONFIG_DISABLE_UNICODE_CASE_CONVERSION -DCONFIG_DISABLE_DATE_BUILTIN -DCONFIG_DISABLE_STRING_BUILTIN \
-DCONFIG_DISABLE_REGEXP_BUILTIN -DCONFIG_DISABLE_TYPEDARRAY_BUILTIN -DCONFIG_ECMA_NUMBER_TYPE=CONFIG_ECMA_NUMBER_FLOAT32 -DCONFIG_MEM_HEAP_AREA_SIZE=512 \
-DCONFIG_ECMA_LCACHE_DISABLE -DJERRY_DISABLE_JS_PARSER -DJERRY_ENABLE_SNAPSHOT_EXEC -DJERRY_NDEBUG -D_BSD_SOURCE \
-D__attr_always_inline___= -DJERRY_CONST_DATA="" -Ijerry-core/ -Ijerry-core/jmem -Ijerry-core/lit -Ijerry-core/ecma -Ijerry-core/ecma/base \
-Ijerry-core/ecma/operations -Ijerry-core/ecma/builtin-objects -Ijerry-core/ecma/builtin-objects/typedarray -Ijerry-core/parser \
-Ijerry-core/parser/regexp -Ijerry-core/parser/js -Ijerry-core/jrt -Ijerry-core/vm -Ijerry-core/api -Ijerry-core/include -Ijerry-core/profiles \
-Ijerry-core/jcontext -Ijerry-core/debugger \
-c js-snapshot.c
```
BUT the code runs until it reaches the following condition
```
if (!jerry_value_is_function(jsFunction)) {
debugf("Error: '%s' is not a function!", functionName);
```
and reports that "sysloop" is not a function?
Therefore I would be very thankful if someone can explain me what am I doing wrong? Again, this is a code that used to work with older versions (at the times when the snapshot save format was having v 6 (now it is v8) )
| Question: Calling function from snapshots | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2189/comments | 7 | 2018-02-01T11:02:46Z | 2018-02-02T08:10:03Z | https://github.com/jerryscript-project/jerryscript/issues/2189 | 293,488,146 | 2,189 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 918eb22a
Build command: ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --compile-flag=-g --jerry-libc=off --static-link=off --strip=off --system-allocator=on --linker-flag=-fuse-ld=gold --error-messages=on --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
function applyTest ( x , y , z ) { }
applyTest.apply('mythis' , { length : 0x40000001 } );
```
###### Backtrace:
```
=================================================================
==12788==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf5f00554 at pc 0x0829f072 bp 0xffd6f7c8 sp 0xffd6f7bc
WRITE of size 4 at 0xf5f00554 thread T0
#0 0x829f071 in ecma_builtin_function_prototype_object_apply jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:140:35
#1 0x829e741 in ecma_builtin_function_prototype_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h:41:1
#2 0x81ecb36 in ecma_builtin_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:108:1
#3 0x81ebb55 in ecma_builtin_dispatch_call jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844:17
#4 0x82038f2 in ecma_op_function_call jerryscript/jerry-core/ecma/operations/ecma-function-object.c:342:19
#5 0x8277f73 in opfunc_call jerryscript/jerry-core/vm/vm.c:425:24
#6 0x825e906 in vm_execute jerryscript/jerry-core/vm/vm.c:2871:7
#7 0x825dc14 in vm_run jerryscript/jerry-core/vm/vm.c:2951:10
#8 0x825d0cf in vm_run_global jerryscript/jerry-core/vm/vm.c:232:28
#9 0x817673c in jerry_run jerryscript/jerry-core/api/jerry.c:559:24
#10 0x816ea31 in main jerryscript/jerry-main/main-unix.c:664:21
#11 0xf7c11985 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18985)
#12 0x806fe97 in _start (jerryscript/build/bin/jerry+0x806fe97)
0xf5f00554 is located 0 bytes to the right of 4-byte region [0xf5f00550,0xf5f00554)
allocated by thread T0 here:
#0 0x81334b4 in malloc (jerryscript/build/bin/jerry+0x81334b4)
#1 0x822a8f7 in jmem_heap_alloc_block_internal jerryscript/jerry-core/jmem/jmem-heap.c:324:10
#2 0x822a644 in jmem_heap_gc_and_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:360:24
#3 0x822a464 in jmem_heap_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:406:10
#4 0x829ee1d in ecma_builtin_function_prototype_object_apply jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:126:9
#5 0x829e741 in ecma_builtin_function_prototype_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h:41:1
#6 0x81ecb36 in ecma_builtin_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:108:1
#7 0x81ebb55 in ecma_builtin_dispatch_call jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844:17
#8 0x82038f2 in ecma_op_function_call jerryscript/jerry-core/ecma/operations/ecma-function-object.c:342:19
#9 0x8277f73 in opfunc_call jerryscript/jerry-core/vm/vm.c:425:24
#10 0x825e906 in vm_execute jerryscript/jerry-core/vm/vm.c:2871:7
#11 0x825dc14 in vm_run jerryscript/jerry-core/vm/vm.c:2951:10
#12 0x825d0cf in vm_run_global jerryscript/jerry-core/vm/vm.c:232:28
#13 0x817673c in jerry_run jerryscript/jerry-core/api/jerry.c:559:24
#14 0x816ea31 in main jerryscript/jerry-main/main-unix.c:664:21
#15 0xf7c11985 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18985)
SUMMARY: AddressSanitizer: heap-buffer-overflow jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:140:35 in ecma_builtin_function_prototype_object_apply
Shadow bytes around the buggy address:
0x3ebe0050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe0060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe0070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe0080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ebe0090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x3ebe00a0: fa fa fa fa fa fa 00 fa fa fa[04]fa fa fa 00 fa
0x3ebe00b0: fa fa 00 fa fa fa 00 00 fa fa 00 00 fa fa 00 fa
0x3ebe00c0: fa fa 00 06 fa fa 00 fa fa fa 00 00 fa fa 00 00
0x3ebe00d0: fa fa 00 fa fa fa 00 fa fa fa 00 01 fa fa 00 01
0x3ebe00e0: fa fa 00 00 fa fa 00 01 fa fa 00 05 fa fa 00 02
0x3ebe00f0: fa fa 00 06 fa fa 00 00 fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==12788==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| heap-buffer-overflow in ecma_builtin_function_prototype_object_apply | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2182/comments | 0 | 2018-01-30T17:37:24Z | 2018-02-01T14:09:54Z | https://github.com/jerryscript-project/jerryscript/issues/2182 | 292,872,837 | 2,182 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 918eb22a
Build command: ./tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
var arrayBuffer = new ArrayBuffer(8);
var start = { toString : function ( ) { throw "inend" ; } };
var end = { valueOf : function ( ) { } };
arrayBuffer.slice(start, end);
```
###### Backtrace:
```
Script Error: TypeError: Expected a function.
ICE: Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed at jerryscript//jerry-core/ecma/base/ecma-literal-storage.c(ecma_free_string_list):43.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x000000000047c68e in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x000000000047c68e in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040bfa4 in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:98
#2 0x000000000040bf76 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x00000000004052cf in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000044adb6 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000044ae08 in jerry_assert_fail (assertion=0x486358 "ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)",
file=0x486308 "jerryscript/jerry-core/ecma/base/ecma-literal-storage.c",
function=0x48e030 <__func__.3700.lto_priv.591> "ecma_free_string_list", line=43)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x000000000045435a in ecma_free_string_list (string_list_p=0x6a1598 <jerry_global_heap+648>)
at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:43
#7 0x00000000004543df in ecma_finalize_lit_storage () at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:60
#8 0x000000000047c359 in ecma_finalize () at jerryscript/jerry-core/ecma/base/ecma-init-finalize.c:65
#9 0x00000000004673ac in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:220
#10 0x00000000004667b5 in main (argc=3, argv=0x7fffffffdd38) at jerryscript/jerry-main/main-unix.c:816
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed in ecma_free_string_list | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2181/comments | 0 | 2018-01-30T13:54:45Z | 2018-02-01T10:30:04Z | https://github.com/jerryscript-project/jerryscript/issues/2181 | 292,790,786 | 2,181 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 918eb22a
Build command: ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --compile-flag=-g --jerry-libc=off --static-link=off --strip=off --system-allocator=on --linker-flag=-fuse-ld=gold --error-messages=on --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
JSON.parse('"' + '\\');
```
###### Backtrace:
```
=================================================================
==20840==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf5d0065a at pc 0x5665f4ca bp 0xffa22e68 sp 0xffa22e58
READ of size 1 at 0xf5d0065a thread T0
#0 0x5665f4c9 in ecma_builtin_json_parse_string jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:164
#1 0x566607e9 in ecma_builtin_json_parse_next_token jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:435
#2 0x56660d80 in ecma_builtin_json_parse_value jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:550
#3 0x56661acf in ecma_builtin_json_parse jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:822
#4 0x5665ef92 in ecma_builtin_json_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h:26
#5 0x566c6de5 in ecma_builtin_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:135
#6 0x566c74d1 in ecma_builtin_dispatch_call jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#7 0x566d06a9 in ecma_op_function_call jerryscript/jerry-core/ecma/operations/ecma-function-object.c:342
#8 0x5667697e in opfunc_call jerryscript/jerry-core/vm/vm.c:425
#9 0x56683328 in vm_execute jerryscript/jerry-core/vm/vm.c:2871
#10 0x56683b6b in vm_run jerryscript/jerry-core/vm/vm.c:2951
#11 0x56675f58 in vm_run_global jerryscript/jerry-core/vm/vm.c:232
#12 0x566dde23 in jerry_run jerryscript/jerry-core/api/jerry.c:559
#13 0x566da945 in main jerryscript/jerry-main/main-unix.c:664
#14 0xf77a8985 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18985)
#15 0x56613150 (jerryscript/build/bin/jerry+0x13150)
0xf5d0065a is located 0 bytes to the right of 10-byte region [0xf5d00650,0xf5d0065a)
allocated by thread T0 here:
#0 0xf7a67bc4 in malloc (/usr/lib32/libasan.so.4+0xe4bc4)
#1 0x5669fa4d in jmem_heap_alloc_block_internal jerryscript/jerry-core/jmem/jmem-heap.c:324
#2 0x5669fb1a in jmem_heap_gc_and_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:360
#3 0x5669fbef in jmem_heap_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:406
#4 0x56683edb in ecma_alloc_string_buffer jerryscript/jerry-core/ecma/base/ecma-alloc.c:182
#5 0x566f7654 in ecma_append_chars_to_string jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:621
#6 0x566f81d4 in ecma_concat_ecma_strings jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:738
#7 0x5661ac4f in opfunc_addition jerryscript/jerry-core/vm/opcodes-ecma-arithmetics.c:154
#8 0x5667d3e9 in vm_loop jerryscript/jerry-core/vm/vm.c:1722
#9 0x566832c7 in vm_execute jerryscript/jerry-core/vm/vm.c:2862
#10 0x56683b6b in vm_run jerryscript/jerry-core/vm/vm.c:2951
#11 0x56675f58 in vm_run_global jerryscript/jerry-core/vm/vm.c:232
#12 0x566dde23 in jerry_run jerryscript/jerry-core/api/jerry.c:559
#13 0x566da945 in main jerryscript/jerry-main/main-unix.c:664
#14 0xf77a8985 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18985)
SUMMARY: AddressSanitizer: heap-buffer-overflow jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-json.c:164 in ecma_builtin_json_parse_string
Shadow bytes around the buggy address:
0x3eba0070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eba0080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eba0090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eba00a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eba00b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x3eba00c0: fa fa fa fa fa fa fa fa fa fa 00[02]fa fa 00 00
0x3eba00d0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 00
0x3eba00e0: fa fa 00 01 fa fa fd fa fa fa 00 05 fa fa 00 02
0x3eba00f0: fa fa 00 06 fa fa 00 00 fa fa fa fa fa fa fa fa
0x3eba0100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3eba0110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==20840==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| heap-buffer-overflow in ecma_builtin_json_parse_string | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2180/comments | 0 | 2018-01-30T13:49:16Z | 2018-02-01T21:34:21Z | https://github.com/jerryscript-project/jerryscript/issues/2180 | 292,788,984 | 2,180 |
[
"jerryscript-project",
"jerryscript"
] | Tested with an old version (ddbe067) and also the current master (0d04c80):
Both strings should match:
```
bad = "'detailForm','detailForm:j_id166', []);\" ><img alt=\"Export to XLS format\" />\n</a>"
good = "'detailForm','detailForm:j_id166');\" ><img alt=\"Export to XLS format\" />\n</a>"
r = /'(detailForm:j_id\d+)'[^>]+>[^>]+Export to XLS format/;
[!!good.match(r), !!bad.match(r)]
```
The result is `true,false`. It looks like the brackets in the `bad` string are the culpint.
---
The bug is actually much simpler: Both `'['.match(/[^>]/)` and `new RegExp("[^a]").exec("[")` return null. The opening brace seems to be missing in negated character classes (tested on desktop Linux i686 athlon).
| Bug in regex concerning brackets in matched text | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2178/comments | 0 | 2018-01-26T22:34:30Z | 2018-01-31T08:27:33Z | https://github.com/jerryscript-project/jerryscript/issues/2178 | 292,052,209 | 2,178 |
[
"jerryscript-project",
"jerryscript"
] | How do you guys feel about adding the "safe" variants of libc functions, for example `memcpy_s`, `strcpy_s` etc? In our project, we're trying to eliminate use of the "unsafe" variants.
I would expect the code size to go up a little bit because of the additional argument(s).
So perhaps it should be a config `#define`?
OTOH, I think replacing the "unsafe" ones with "safe" ones would I think would avoid accidents and also avoid having `#define`s all over the place.
I imagine to add implementations to `jerry-libc`, I suspect some toolchains may not support these C11 additions yet. Having them in `jerry-libc` would be an easy compatibility path for those cases.
Thoughts? @akosthekiss @zherczeg | Using C11 safe (_s) libc functions? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2175/comments | 7 | 2018-01-25T08:36:47Z | 2019-10-22T14:39:31Z | https://github.com/jerryscript-project/jerryscript/issues/2175 | 291,489,243 | 2,175 |
[
"jerryscript-project",
"jerryscript"
] | Specifically this check `(ecma_string_get_size (str_p) > buffer_size)` is exiting as expected if the jerry value is larger than the buffer.
However it would be nice if there was another function that would be more tolerant of too big jerry string, by simply dropping the extra characters.
I'm not too sure on the best option of dealing with this. Should this be a seperate function like `jerry_string_to_char_buffer_unsafe()`?
Note: If you are approaching this, then also check if ecma_string_copy_to_cesu8_buffer() actually checks buffer_size(), as memcpy uses the jerry string size rather than declared buffer size (or the smallest of either).
https://github.com/jerryscript-project/jerryscript/blob/master/jerry-core/api/jerry.c#L1489 | Is there a jerry_string_to_char_buffer() that will fill a buffer, even if jerry string is too big? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2173/comments | 5 | 2018-01-24T05:57:07Z | 2018-02-08T12:43:18Z | https://github.com/jerryscript-project/jerryscript/issues/2173 | 291,092,987 | 2,173 |
[
"jerryscript-project",
"jerryscript"
] | Hey JrS people!
I'm trying to implement a native binding much alike Node's [`require.resolve()`](https://nodejs.org/api/modules.html#modules_require_resolve_request_options)
The tricky thing about the `require.resolve` function is that when using a relative path, i.e. `require.resolve('./thing.js')` the look up happens relative to the source file in which the `require.resolve()` call was written.
I noticed that for the JerryScript debugger support, `jerry_parse_named_resource` was added, which seemed promising at a glance. Unfortunately, the "resource name" is merely passed off to the debugger client and not kept around.
Any suggestions on how to solve this?
I guess I want an API like `const jerry_char_t *jerry_get_current_resource_name(void);` that would return the currently executing resource name (or `NULL` if no named resource is executing / it's not available).
For reference, V8 has a [`GetScriptName()`](https://v8docs.nodesource.com/node-9.3/dd/d1e/classv8_1_1_stack_frame.html#a63d53e7637627027f0fe77e0e9dbeab7) method on the `StackFrame` class which is similar to what I'm looking for. | Keep resource name for function objects? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2170/comments | 3 | 2018-01-23T10:05:20Z | 2019-10-21T13:19:49Z | https://github.com/jerryscript-project/jerryscript/issues/2170 | 290,776,978 | 2,170 |
[
"jerryscript-project",
"jerryscript"
] | I want to define `Buffer` class like in Node.js. According to the Node.js docs, a buffer object can be used like as an array. For example, you can read a byte data at the first index by `buffer[0]`.
I'm trying to implement Buffer object in native C and I found `jerry_define_own_property`. But I don't know how to define getter for array-like indexing. Is it possible to define getter/setter for array-like indexing? If so, how to do it? | How to define getter/setter for array-like indexing? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2156/comments | 3 | 2017-12-26T03:57:16Z | 2018-05-10T06:17:52Z | https://github.com/jerryscript-project/jerryscript/issues/2156 | 284,489,461 | 2,156 |
[
"jerryscript-project",
"jerryscript"
] | After the recent conversation on DigitalIn and friends, I think we need to change how the Mbed OS and JerryScript integrate. Having part of the build toolchain in jerryscript core repository does not make sense, and things like generating `main.cpp` and the `Makefile` from here are also annoying for users, as they'd need to dive into the jerryscript repository to change these. Additionally, the Mbed.js build system is now different from the normal Mbed OS build system, which adds overhead.
So in the next few weeks I plan to open a PR to remove the mbedos5 target from JerryScript.
Current development for the new system is at https://github.com/ARMmbed/mbed-js-v2 - this no longer requires mbedos5 target in JerryScript to be present. | Remove mbedos5 target | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2149/comments | 4 | 2017-12-13T08:41:26Z | 2019-01-11T16:20:42Z | https://github.com/jerryscript-project/jerryscript/issues/2149 | 281,666,091 | 2,149 |
[
"jerryscript-project",
"jerryscript"
] | the target `Mbed/K64F` failed in CI. seems the URL error or the version conflict
```
removed ‘/etc/apt/sources.list.d/basho_riak.list’
Executing: /tmp/tmp.qLWGriNsXE/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
EA312927
gpg: requesting key EA312927 from hkp server keyserver.ubuntu.com
gpg: key EA312927: public key "MongoDB 3.2 Release Signing Key <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
W: The repository 'http://ppa.launchpad.net/couchdb/stable/ubuntu trusty Release' does not have a Release file.
W: Failed to fetch https://packagecloud.io/computology/apt-backport/ubuntu/dists/trusty/InRelease Failed to connect to packagecloud.io port 443: Connection timed out
W: Failed to fetch http://repo.mongodb.org/apt/ubuntu/dists/trusty/mongodb-org/3.4/InRelease Could not connect to repo.mongodb.org:80 (52.222.215.211), connection timed out
W: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/trusty/InRelease Could not connect to ppa.launchpad.net:80 (91.189.95.83), connection timed out
W: Failed to fetch http://ppa.launchpad.net/pollinate/ppa/ubuntu/dists/trusty/InRelease Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/InRelease Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/chris-lea/redis-server/ubuntu/dists/trusty/main/binary-amd64/Packages Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/chris-lea/redis-server/ubuntu/dists/trusty/main/binary-i386/Packages Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/chris-lea/redis-server/ubuntu/dists/trusty/main/i18n/Translation-en Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/git-core/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/git-core/ppa/ubuntu/dists/trusty/main/binary-i386/Packages Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/git-core/ppa/ubuntu/dists/trusty/main/i18n/Translation-en Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/couchdb/stable/ubuntu/dists/trusty/main/binary-amd64/Packages Unable to connect to ppa.launchpad.net:http:
W: Failed to fetch http://ppa.launchpad.net/couchdb/stable/ubuntu/dists/trusty/main/binary-i386/Packages Unable to connect to ppa.launchpad.net:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.
```
```
$ make -f ./targets/mbed/Makefile.travis install
sudo apt-get install -q -y ninja-build libffi-dev libssl-dev
Reading package lists...
Building dependency tree...
Reading state information...
libffi-dev is already the newest version (3.1~rc1+r3.0.13-12ubuntu0.2).
libssl-dev is already the newest version (1.0.1f-1ubuntu2.23).
libssl-dev set to manually installed.
The following NEW packages will be installed:
ninja-build
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 79.6 kB of archives.
After this operation, 317 kB of additional disk space will be used.
Get:1 http://us-central1.gce.archive.ubuntu.com/ubuntu trusty-updates/main amd64 ninja-build amd64 1.3.4-1.1ubuntu0.14.04.1 [79.6 kB]
Fetched 79.6 kB in 0s (4,697 kB/s)
Selecting previously unselected package ninja-build.
(Reading database ... 101322 files and directories currently installed.)
Preparing to unpack .../ninja-build_1.3.4-1.1ubuntu0.14.04.1_amd64.deb ...
Unpacking ninja-build (1.3.4-1.1ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up ninja-build (1.3.4-1.1ubuntu0.14.04.1) ...
pyenv global 2.7.13 # force the python version to a newer one
pyenv: version `2.7.13' not installed
make: *** [install-yotta] Error 1
The command "make -f ./targets/mbed/Makefile.travis install" failed and exited with 2 during .
Your build has been stopped.
``` | CI failed in Mbed/K64F build | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2148/comments | 2 | 2017-12-13T04:44:30Z | 2018-05-18T18:01:25Z | https://github.com/jerryscript-project/jerryscript/issues/2148 | 281,623,817 | 2,148 |
[
"jerryscript-project",
"jerryscript"
] | in ecma_gc_mark function
```
JERRY_ASSERT (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP
|| ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));
ecma_gc_mark_property ((ecma_property_pair_t *) prop_iter_p, 0);
ecma_gc_mark_property ((ecma_property_pair_t *) prop_iter_p, 1);
```
it call ecma_gc_mark_property function.
```
static void
ecma_gc_mark_property (ecma_property_pair_t *property_pair_p, /**< property pair */
uint32_t index) /**< property index */
...
```
but type of argument can be hashmap. this make no problem in most situation because header.types[0] will be always 4( ECMA_PROPERTY_TYPE_HASHMAP ) and types[1] will be 0 and handled by function in this case . but types[1] of hashmap is shiftcounter so it can be bigger number in very specific case ( in below code, when max_property_count is bigger than LIT_STRING_HASH_LIMIT ... )
```
//jerry-core/ecma/base/ecma-property-hashmap.c
void
ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
{
......
......
if (max_property_count <= LIT_STRING_HASH_LIMIT)
{
hashmap_p->header.types[1] = 0;
}
else
{
while (max_property_count > LIT_STRING_HASH_LIMIT)
{
shift_counter++;
max_property_count >>= 1;
}
}
hashmap_p->header.types[1] = shift_counter;
.....
```
if shift_counter is bigger than 0 then type misuse bug code can be executed
```
static void
ecma_gc_mark_property (ecma_property_pair_t *property_pair_p, /**< property pair */
uint32_t index) /**< property index */
{
...
ecma_value_t value = property_pair_p->values[index].value;
``` | misuse of type in ecma_gc_mark_property function which can lead to memory corruption | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2146/comments | 2 | 2017-12-12T02:07:06Z | 2018-02-22T00:13:50Z | https://github.com/jerryscript-project/jerryscript/issues/2146 | 281,232,209 | 2,146 |
[
"jerryscript-project",
"jerryscript"
] | I've found a strange parsing problem in object expression.
```
jerry> { a: 1, b: "abc" }
Script Error: SyntaxError
```
The above expression results a parsing error. But, the below works well.
```
jerry> var x = { a: 1, b: "abc" };
undefined
```
One more strange thing is the following:
```
jerry> { a: 1 }
1
```
This should results "[object Object]", isn't it?
| Parsing problem in object expression | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2145/comments | 4 | 2017-12-09T06:34:00Z | 2017-12-11T05:38:03Z | https://github.com/jerryscript-project/jerryscript/issues/2145 | 280,692,281 | 2,145 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 90f2473f
Build command: tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
var a = new Uint8Array(2);
a[0] = { valueOf : function() { throw "intoint" ; } };
```
###### Backtrace:
```
ICE: Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c(ecma_free_string_list):43.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0xf7fd5db9 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7fd5db9 in __kernel_vsyscall ()
#1 0xf7ca47e2 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xf7ca5f51 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0x0835ed6e in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x0822aa4b in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x0822aac1 in jerry_assert_fail (assertion=0x839e880 <.str.2> "ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)",
file=0x839e7a0 <.str.1> "jerryscript/jerry-core/ecma/base/ecma-literal-storage.c",
function=0x839e8e0 <__func__.ecma_free_string_list> "ecma_free_string_list", line=43)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x081d36ba in ecma_free_string_list (string_list_p=0xf6300710)
at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:43
#7 0x081d3432 in ecma_finalize_lit_storage () at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:60
#8 0x081d168f in ecma_finalize () at jerryscript/jerry-core/ecma/base/ecma-init-finalize.c:65
#9 0x0817530d in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:219
#10 0x0816f58d in main (argc=3, argv=0xffffd074) at jerryscript/jerry-main/main-unix.c:816
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed in ecma_free_string_list | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2143/comments | 1 | 2017-12-08T10:55:19Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/2143 | 280,450,416 | 2,143 |
[
"jerryscript-project",
"jerryscript"
] | the following poc can trigger a heap buffer overflow bugs.
==========================
RegExp("[\\x0");
==========================
==3847==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xb580075d at pc 0x081224b6 bp 0xbfb5e7f8 sp 0xbfb5e7e8
READ of size 1 at 0xb580075d thread T0
#0 0x81224b5 in lit_read_code_unit_from_hex /home/b/jerryscript/jerry-core/lit/lit-char-helpers.c:443
#1 0x81901c2 in re_parse_char_class /home/b/jerryscript/jerry-core/parser/regexp/re-parser.c:434
#2 0x818bd71 in re_parse_alternative /home/b/jerryscript/jerry-core/parser/regexp/re-compiler.c:390
#3 0x818d717 in re_compile_bytecode /home/b/jerryscript/jerry-core/parser/regexp/re-compiler.c:560
#4 0x8106af7 in ecma_op_create_regexp_object /home/b/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:292
#5 0x80af355 in ecma_builtin_regexp_dispatch_construct /home/b/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c:136
#6 0x80ae0dd in ecma_builtin_dispatch_call /home/b/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:171
#7 0x80fbd5e in ecma_op_function_call /home/b/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:341
#8 0x81a83c6 in opfunc_call /home/b/jerryscript/jerry-core/vm/vm.c:425
#9 0x81a83c6 in vm_execute /home/b/jerryscript/jerry-core/vm/vm.c:2862
#10 0x81a9dd5 in vm_run /home/b/jerryscript/jerry-core/vm/vm.c:2942
#11 0x81a9dd5 in vm_run_global /home/b/jerryscript/jerry-core/vm/vm.c:232
#12 0x8058201 in jerry_run /home/b/jerryscript/jerry-core/api/jerry.c:558
#13 0x804c503 in main /home/b/jerryscript/jerry-main/main-unix.c:664
#14 0xb6fc2636 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18636)
#15 0x804fc9d (/home/b/jerryscript/build/bin/jerry+0x804fc9d)
0xb580075d is located 0 bytes to the right of 13-byte region [0xb5800750,0xb580075d)
allocated by thread T0 here:
#0 0xb71f6dee in malloc (/usr/lib/i386-linux-gnu/libasan.so.2+0x96dee)
#1 0x804f4c4 in jmem_heap_alloc_block_internal /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:324
#2 0x804f4c4 in jmem_heap_gc_and_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:360
#3 0x804f4c4 in jmem_heap_alloc_block /home/b/jerryscript/jerry-core/jmem/jmem-heap.c:406
#4 0x806ab0b in ecma_new_ecma_string_from_utf8 /home/b/jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:190
#5 0x8064a63 in ecma_find_or_create_literal_string /home/b/jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:73
#6 0x812ccbb in parser_compute_indicies /home/b/jerryscript/jerry-core/parser/js/js-parser.c:201
#7 0x812ccbb in parser_post_processing /home/b/jerryscript/jerry-core/parser/js/js-parser.c:1421
#8 0x8139743 in parser_parse_source /home/b/jerryscript/jerry-core/parser/js/js-parser.c:2215
#9 0x813b528 in parser_parse_script /home/b/jerryscript/jerry-core/parser/js/js-parser.c:2712
#10 0x80578b1 in jerry_parse /home/b/jerryscript/jerry-core/api/jerry.c:384
#11 0x80578b1 in jerry_parse_named_resource /home/b/jerryscript/jerry-core/api/jerry.c:442
#12 0x804c49d in main /home/b/jerryscript/jerry-main/main-unix.c:655
#13 0xb6fc2636 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18636)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/b/jerryscript/jerry-core/lit/lit-char-helpers.c:443 lit_read_code_unit_from_hex
Shadow bytes around the buggy address:
0x36b00090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b000a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b000b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b000c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b000d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fd fa
=>0x36b000e0: fa fa 00 fa fa fa 00 00 fa fa 00[05]fa fa fd fa
0x36b000f0: fa fa 00 05 fa fa 00 02 fa fa 00 06 fa fa 00 00
0x36b00100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b00110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b00120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b00130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
==3847==ABORTING
the platform is ubuntu 16.04 and the build options are:
python ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --jerry-libc=off --static-link=off --lto=off --error-message=on --system-allocator=on | heap-buffer-overflow in lit_read_code_unit_from_hex | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2140/comments | 2 | 2017-12-07T06:24:06Z | 2018-02-06T04:47:21Z | https://github.com/jerryscript-project/jerryscript/issues/2140 | 280,015,856 | 2,140 |
[
"jerryscript-project",
"jerryscript"
] | I was trying to put a code compiled with Emscripten and run them on both node.js and iot.js, however iot.js fails to parse a particular regular expression. After tracing the issue I think JerryScript is not-compliant with other ECMA Script implementations.
The line given by Emscripten is (matching a JavaScript function):
`var sourceRegex = /^function\s*[a-zA-Z$_0-9]*\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;`
The minified code which produces a parsing error in jerryscript is:
`var sourceRegex = /{}/;`
On other JavaScript engines (like v8, node.js and the script console on my Firefox), the above minified code passed the parsing, while in JerryScript (and thus iot.js), it results in a parsing error.
Section 15.10 of ECMA262 seems to allow the above regular expression as the "{" (or "}" character) can be interpreted as an Atom instead of a start of QuantifierPrefix:
https://www.ecma-international.org/ecma-262/5.1/#sec-15.10 | Parsing Problem for Regex containing {} brackets | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2134/comments | 5 | 2017-12-04T06:53:52Z | 2018-01-24T11:23:03Z | https://github.com/jerryscript-project/jerryscript/issues/2134 | 278,889,190 | 2,134 |
[
"jerryscript-project",
"jerryscript"
] | The current `jerryx_arg_string` ends up in a call into `jerry_string_to_char_buffer`.
That function writes the string using the internal CESU-8 encoding.
I'd be good to have a variant of this that uses UTF-8 encoding instead. | Add `jerryx_arg_utf8_string` to jerryx arg.h utility | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2132/comments | 3 | 2017-12-01T09:09:09Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/2132 | 278,401,404 | 2,132 |
[
"jerryscript-project",
"jerryscript"
] | Is there a simple example about JS calling c ++?
How to call c ++ member functions in js file? | A little confused about JS calling c ++ | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2127/comments | 9 | 2017-11-29T02:41:26Z | 2019-01-12T11:33:22Z | https://github.com/jerryscript-project/jerryscript/issues/2127 | 277,610,156 | 2,127 |
[
"jerryscript-project",
"jerryscript"
] | I want to call javascript function in *.js file from C
example hello.js, containing func1, func2, In C function, How do I call func1 in C files?
In this case, how can i export all js functions to object for calling in C code? | How call JavaScript function from C | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2124/comments | 4 | 2017-11-28T01:47:12Z | 2017-11-28T11:49:34Z | https://github.com/jerryscript-project/jerryscript/issues/2124 | 277,230,273 | 2,124 |
[
"jerryscript-project",
"jerryscript"
] | make -f ./targets/esp8266/Makefile.esp8266
/home/wang/jerryscript/jerry-core/ecma/base/ecma-globals.h:115:5: error: "UINTPTR_MAX" is not defined [-Werror=undef]
#if UINTPTR_MAX <= UINT32_MAX
^
cc1: some warnings being treated as errors
jerry-core/CMakeFiles/jerry-core.dir/build.make:62: recipe for target 'jerry-core/CMakeFiles/jerry-core.dir/__/jerry-all-in.c.obj' failed
make[4]: *** [jerry-core/CMakeFiles/jerry-core.dir/__/jerry-all-in.c.obj] Error 1
make[4]: Leaving directory '/home/wang/jerryscript/build/obj-esp8266'
CMakeFiles/Makefile2:140: recipe for target 'jerry-core/CMakeFiles/jerry-core.dir/all' failed
make[3]: *** [jerry-core/CMakeFiles/jerry-core.dir/all] Error 2
make[3]: Leaving directory '/home/wang/jerryscript/build/obj-esp8266'
CMakeFiles/Makefile2:152: recipe for target 'jerry-core/CMakeFiles/jerry-core.dir/rule' failed
make[2]: *** [jerry-core/CMakeFiles/jerry-core.dir/rule] Error 2
make[2]: Leaving directory '/home/wang/jerryscript/build/obj-esp8266'
Makefile:175: recipe for target 'jerry-core' failed
make[1]: *** [jerry-core] Error 2
make[1]: Leaving directory '/home/wang/jerryscript/build/obj-esp8266'
targets/esp8266/Makefile.esp8266:44: recipe for target 'jerry' failed
make: *** [jerry] Error 2
| error: "UINTPTR_MAX" is not defined | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2118/comments | 8 | 2017-11-22T08:41:17Z | 2018-01-29T08:57:37Z | https://github.com/jerryscript-project/jerryscript/issues/2118 | 275,984,729 | 2,118 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7692aa9d
Build command: tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
var value = {};
var poisonedThen = Object.defineProperty({}, 'then', {
get: function() {
throw value;
}
});
var promise = new Promise(function(resolve) {
resolve(poisonedThen);
});
```
###### Backtrace:
```
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript/jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):181.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040ca61 in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:98
#2 0x000000000040ca33 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000405d8c in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000044371c in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000044376e in jerry_assert_fail (assertion=0x487600 "JERRY_CONTEXT (jmem_heap_allocated_size) == 0",
file=0x487588 "jerryscript/jerry-core/jmem/jmem-heap.c",
function=0x494560 <__func__.3199.lto_priv.392> "jmem_heap_finalize", line=181) at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x0000000000442d33 in jmem_heap_finalize () at jerryscript/jerry-core/jmem/jmem-heap.c:181
#7 0x00000000004429a8 in jmem_finalize () at jerryscript/jerry-core/jmem/jmem-allocator.c:51
#8 0x0000000000465535 in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:220
#9 0x0000000000464919 in main (argc=3, argv=0x7fffffffde88) at jerryscript/jerry-main/main-unix.c:808
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed in jmem_heap_finalize | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2111/comments | 1 | 2017-11-16T10:45:47Z | 2017-11-22T05:35:28Z | https://github.com/jerryscript-project/jerryscript/issues/2111 | 274,470,904 | 2,111 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7692aa9d
Build command: tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
var arrowFn = () => {};
arrowFn.hasOwnProperty('caller');
```
###### Backtrace:
```
ICE: Assertion '((jmem_cpointer_t) uint_ptr) == uint_ptr' failed at jerryscript/jerry-core/jmem/jmem-allocator.c(jmem_decompress_pointer):100.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040ca61 in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:98
#2 0x000000000040ca33 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000405d8c in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000044371c in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000044376e in jerry_assert_fail (assertion=0x4874a8 "((jmem_cpointer_t) uint_ptr) == uint_ptr",
file=0x487400 "jerryscript/jerry-core/jmem/jmem-allocator.c",
function=0x4944b0 <__func__.3201.lto_priv.432> "jmem_decompress_pointer", line=100)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x0000000000442b4e in jmem_decompress_pointer (compressed_pointer=3670022)
at jerryscript/jerry-core/jmem/jmem-allocator.c:100
#7 0x000000000045ab0d in ecma_op_function_try_to_lazy_instantiate_property (object_p=0x6a53e8 <jerry_global_heap+216>,
property_name_p=0x6a5500 <jerry_global_heap+496>) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:789
#8 0x000000000045dfe0 in ecma_op_object_get_own_property (object_p=0x6a53e8 <jerry_global_heap+216>,
property_name_p=0x6a5500 <jerry_global_heap+496>, property_ref_p=0x0, options=0)
at jerryscript/jerry-core/ecma/operations/ecma-objects.c:243
#9 0x000000000045e2c8 in ecma_op_object_has_own_property (object_p=0x6a53e8 <jerry_global_heap+216>,
property_name_p=0x6a5500 <jerry_global_heap+496>) at jerryscript/jerry-core/ecma/operations/ecma-objects.c:362
#10 0x0000000000428053 in ecma_builtin_object_prototype_object_has_own_property (this_arg=219, arg=498)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c:153
#11 0x0000000000427d19 in ecma_builtin_object_prototype_dispatch_routine (builtin_routine_id=61, this_arg_value=219,
arguments_list=0x7fffffffdb1c, arguments_number=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h:35
#12 0x0000000000453b83 in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, builtin_routine_id=61,
this_arg_value=219, arguments_list=0x7fffffffdb1c, arguments_number=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:20
#13 0x00000000004542ce in ecma_builtin_dispatch_call (obj_p=0x6a53f8 <jerry_global_heap+232>, this_arg_value=219,
arguments_list_p=0x7fffffffdb1c, arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#14 0x0000000000459db6 in ecma_op_function_call (func_obj_p=0x6a53f8 <jerry_global_heap+232>, this_arg_value=219,
arguments_list_p=0x7fffffffdb1c, arguments_list_len=1) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:343
#15 0x000000000044d740 in opfunc_call (frame_ctx_p=0x7fffffffdb60) at jerryscript/jerry-core/vm/vm.c:425
#16 0x000000000045262d in vm_execute (frame_ctx_p=0x7fffffffdb60, arg_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2804
#17 0x00000000004528b4 in vm_run (bytecode_header_p=0x6a5520 <jerry_global_heap+528>, this_binding_value=27,
lex_env_p=0x6a5340 <jerry_global_heap+48>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2884
#18 0x000000000044d368 in vm_run_global (bytecode_p=0x6a5520 <jerry_global_heap+528>) at jerryscript/jerry-core/vm/vm.c:232
#19 0x0000000000465b61 in jerry_run (func_val=203) at jerryscript/jerry-core/api/jerry.c:558
#20 0x0000000000464670 in main (argc=3, argv=0x7fffffffde88) at jerryscript/jerry-main/main-unix.c:656
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion '((jmem_cpointer_t) uint_ptr) == uint_ptr' failed in jmem_decompress_pointer | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2110/comments | 1 | 2017-11-16T10:39:40Z | 2017-12-25T09:42:26Z | https://github.com/jerryscript-project/jerryscript/issues/2110 | 274,469,106 | 2,110 |
[
"jerryscript-project",
"jerryscript"
] | @jiangzidong the following code snippet is based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
```js
var p1 = new Promise(function(resolve, reject) {
reject('Failed');
});
p1.then(function(value) {
console.log(value); // "Success!"
}).catch(function(e) {
console.log(e); // "oh, no!"
throw e; // forward the error
}).then(function(){
console.log('after a catch the chain is restored');
}, function () {
console.log('Not fired due to the catch');
throw("This won't be caught");
});
```
My question is that how can I throw an error from a Promise? The code above works with V8 (tested on node.js and chrome console) but not in JerryScript. What is the correct behavior? I'd like to validate the `resolve` and `reject` calls in `then`, but I cannot throw an error from `then`. | How to throw an exception in Promise | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2109/comments | 1 | 2017-11-16T09:46:18Z | 2018-02-16T09:29:41Z | https://github.com/jerryscript-project/jerryscript/issues/2109 | 274,452,815 | 2,109 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7692aa9d
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
print(new Number(8e-9).toFixed(20));
```
###### Backtrace:
```
ICE: Assertion 'lit_is_valid_cesu8_string (string_p, string_size)' failed at jerryscript/jerry-core/ecma/base/ecma-helpers-string.c(ecma_new_ecma_string_from_utf8):154.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0xf7fd5db9 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7fd5db9 in __kernel_vsyscall ()
#1 0xf7816352 in raise () from /lib32/libc.so.6
#2 0xf7817a51 in abort () from /lib32/libc.so.6
#3 0x565743e6 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x565e32fb in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x565e333c in jerry_assert_fail (assertion=0x56697080 "lit_is_valid_cesu8_string (string_p, string_size)",
file=0x56696f20 "jerryscript/jerry-core/ecma/base/ecma-helpers-string.c",
function=0x56665300 <__func__.3043.lto_priv.642> "ecma_new_ecma_string_from_utf8", line=154)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x56627f03 in ecma_new_ecma_string_from_utf8 (string_p=0xf5f008e0 "0.000000008", string_size=22)
at jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:154
#7 0x565b7a3c in ecma_builtin_number_prototype_object_to_fixed (this_arg=4126148979, arg=320)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c:691
#8 0x565b508a in ecma_builtin_number_prototype_dispatch_routine (builtin_routine_id=61, this_arg_value=4126148979,
arguments_list=0xffffcb70, arguments_number=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h:37
#9 0x56647ed6 in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, builtin_routine_id=61,
this_arg_value=4126148979, arguments_list=0xffffcb70, arguments_number=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:91
#10 0x56648652 in ecma_builtin_dispatch_call (obj_p=0xf5f00940, this_arg_value=4126148979, arguments_list_p=0xffffcb70,
arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#11 0x56613f96 in ecma_op_function_call (func_obj_p=0xf5f00940, this_arg_value=4126148979, arguments_list_p=0xffffcb70,
arguments_list_len=1) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:343
#12 0x565fd55b in opfunc_call (frame_ctx_p=0xffffcbe0) at jerryscript/jerry-core/vm/vm.c:425
#13 0x5660a0fd in vm_execute (frame_ctx_p=0xffffcbe0, arg_p=0x0, arg_list_len=0) at jerryscript/jerry-core/vm/vm.c:2804
#14 0x5660a940 in vm_run (bytecode_header_p=0xf5300f50, this_binding_value=4126149459, lex_env_p=0xf5d007b0, is_eval_code=false,
arg_list_p=0x0, arg_list_len=0) at jerryscript/jerry-core/vm/vm.c:2884
#15 0x565fca81 in vm_run_global (bytecode_p=0xf5300f50) at jerryscript/jerry-core/vm/vm.c:232
#16 0x5664e8bc in jerry_run (func_val=4126149123) at jerryscript/jerry-core/api/jerry.c:558
#17 0x5664b236 in main (argc=3, argv=0xffffd024) at jerryscript/jerry-main/main-unix.c:657
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'lit_is_valid_cesu8_string (string_p, string_size)' failed in ecma_new_ecma_string_from_utf8 | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2108/comments | 4 | 2017-11-16T09:38:05Z | 2017-11-17T19:00:46Z | https://github.com/jerryscript-project/jerryscript/issues/2108 | 274,450,241 | 2,108 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7692aa9d
Build command: ./tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
var thenableWithError = {
then: function() { throw new Error("") }
}
function executor(resolve) {
resolve(thenableWithError)
}
new Promise(executor).a()
```
###### Backtrace:
```
ICE: Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c(ecma_free_string_list):43.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040ca61 in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:98
#2 0x000000000040ca33 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000405d8c in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000044371c in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000044376e in jerry_assert_fail (assertion=0x48f910 "ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)",
file=0x48f8c8 "jerryscript/jerry-core/ecma/base/ecma-literal-storage.c",
function=0x492230 <__func__.3687> "ecma_free_string_list", line=43) at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x000000000047ae81 in ecma_free_string_list (string_list_p=0x6a5590 <jerry_global_heap+640>)
at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:43
#7 0x000000000047af06 in ecma_finalize_lit_storage () at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:60
#8 0x000000000047a685 in ecma_finalize () at jerryscript/jerry-core/ecma/base/ecma-init-finalize.c:65
#9 0x0000000000465530 in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:219
#10 0x0000000000464919 in main (argc=3, argv=0x7fffffffded8) at jerryscript/jerry-main/main-unix.c:808
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed in ecma_free_string_list | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2107/comments | 1 | 2017-11-16T08:57:39Z | 2017-11-22T05:36:04Z | https://github.com/jerryscript-project/jerryscript/issues/2107 | 274,438,728 | 2,107 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7692aa9d
Build command: ./tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
new Float32Array({ length: 0x40000001 })
```
###### Backtrace:
```
ICE: Assertion 'ecma_get_value_type_field (value) == ECMA_TYPE_OBJECT' failed at jerryscript/jerry-core/ecma/base/ecma-helpers-value.c(ecma_get_object_from_value):583.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x00000000004809d6 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040ca61 in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:98
#2 0x000000000040ca33 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000405d8c in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000044371c in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000044376e in jerry_assert_fail (assertion=0x48ead8 "ecma_get_value_type_field (value) == ECMA_TYPE_OBJECT",
file=0x48e910 "jerryscript/jerry-core/ecma/base/ecma-helpers-value.c",
function=0x491b40 <__func__.3196> "ecma_get_object_from_value", line=583) at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x0000000000476813 in ecma_get_object_from_value (value=24) at jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:583
#7 0x00000000004631bc in ecma_op_typedarray_from (items_val=251, map_fn_val=72, this_val=72, proto_p=0x6a5440 <jerry_global_heap+304>,
element_size_shift=2 '\002', class_id=LIT_MAGIC_STRING_FLOAT32_ARRAY_UL)
at jerryscript/jerry-core/ecma/operations/ecma-typedarray-object.c:423
#8 0x0000000000442199 in ecma_op_create_typedarray (arguments_list_p=0x7fffffffdb74, arguments_list_len=1,
proto_p=0x6a5440 <jerry_global_heap+304>, element_size_shift=2 '\002', class_id=LIT_MAGIC_STRING_FLOAT32_ARRAY_UL)
at jerryscript/jerry-core/ecma/operations/ecma-typedarray-object.c:723
#9 0x0000000000454b6d in ecma_builtin_float32array_dispatch_construct (arguments_list_p=0x7fffffffdb74, arguments_list_len=1)
at jerryscript/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c:69
#10 0x000000000045498d in ecma_builtin_dispatch_construct (obj_p=0x6a53f8 <jerry_global_heap+232>, arguments_list_p=0x7fffffffdb74,
arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:426
#11 0x000000000045a736 in ecma_op_function_construct (func_obj_p=0x6a53f8 <jerry_global_heap+232>, arguments_list_p=0x7fffffffdb74,
arguments_list_len=1) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:653
#12 0x000000000044d87d in opfunc_construct (frame_ctx_p=0x7fffffffdbb0) at jerryscript/jerry-core/vm/vm.c:483
#13 0x000000000045266f in vm_execute (frame_ctx_p=0x7fffffffdbb0, arg_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2809
#14 0x00000000004528b4 in vm_run (bytecode_header_p=0x6a5528 <jerry_global_heap+536>, this_binding_value=27,
lex_env_p=0x6a5340 <jerry_global_heap+48>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2884
#15 0x000000000044d368 in vm_run_global (bytecode_p=0x6a5528 <jerry_global_heap+536>) at jerryscript/jerry-core/vm/vm.c:232
#16 0x0000000000465b61 in jerry_run (func_val=203) at jerryscript/jerry-core/api/jerry.c:558
#17 0x0000000000464670 in main (argc=3, argv=0x7fffffffded8) at jerryscript/jerry-main/main-unix.c:656
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'ecma_get_value_type_field (value) == ECMA_TYPE_OBJECT' failed in ecma_get_object_from_value | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2106/comments | 0 | 2017-11-16T08:53:59Z | 2017-11-20T07:55:23Z | https://github.com/jerryscript-project/jerryscript/issues/2106 | 274,437,734 | 2,106 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7692aa9d
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
Object.freeze (this)
{
eval('{ function boo() {} }')
}
```
###### Backtrace:
```
ICE: Assertion 'ecma_is_value_empty (completion_value)' failed at jerryscript/jerry-core/vm/opcodes.c(vm_var_decl):58.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x0000000000475246 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x0000000000475246 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040ddfe in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:98
#2 0x000000000040ddd0 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000407129 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000044dc48 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000044dc9a in jerry_assert_fail (assertion=0x475538 "ecma_is_value_empty (completion_value)",
file=0x475508 "jerryscript/jerry-core/vm/opcodes.c", function=0x48afc8 <__func__.3502.lto_priv.46> "vm_var_decl", line=58)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x0000000000401bc0 in vm_var_decl (frame_ctx_p=0x7fffffffd740, var_name_str_p=0x695a28 <jerry_global_heap+2024>)
at jerryscript/jerry-core/vm/opcodes.c:58
#7 0x0000000000433630 in vm_init_loop (frame_ctx_p=0x7fffffffd740) at jerryscript/jerry-core/vm/vm.c:675
#8 0x0000000000437fcf in vm_execute (frame_ctx_p=0x7fffffffd740, arg_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2791
#9 0x0000000000438289 in vm_run (bytecode_header_p=0x695a10 <jerry_global_heap+2000>, this_binding_value=27,
lex_env_p=0x695268 <jerry_global_heap+40>, is_eval_code=true, arg_list_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2884
#10 0x0000000000432e4e in vm_run_eval (bytecode_data_p=0x695a10 <jerry_global_heap+2000>, is_direct=true)
at jerryscript/jerry-core/vm/vm.c:277
#11 0x00000000004461ca in ecma_op_eval_chars_buffer (code_p=0x695420 <jerry_global_heap+480> "{ function boo() {} }", code_buffer_size=21,
is_direct=true, is_called_from_strict_mode_code=false) at jerryscript/jerry-core/ecma/operations/ecma-eval.c:103
#12 0x00000000004460b4 in ecma_op_eval (code_p=0x695418 <jerry_global_heap+472>, is_direct=true, is_called_from_strict_mode_code=false)
at jerryscript/jerry-core/ecma/operations/ecma-eval.c:58
#13 0x0000000000422389 in ecma_builtin_global_object_eval (this_arg=72, x=474)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-global.c:87
#14 0x000000000042213a in ecma_builtin_global_dispatch_routine (builtin_routine_id=34, this_arg_value=72, arguments_list=0x7fffffffdb64,
arguments_number=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h:203
#15 0x0000000000473fe0 in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_GLOBAL, builtin_routine_id=34,
this_arg_value=72, arguments_list=0x7fffffffdb64, arguments_number=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:484
#16 0x000000000047416a in ecma_builtin_dispatch_call (obj_p=0x6956b8 <jerry_global_heap+1144>, this_arg_value=72,
arguments_list_p=0x7fffffffdb64, arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#17 0x0000000000446a95 in ecma_op_function_call (func_obj_p=0x6956b8 <jerry_global_heap+1144>, this_arg_value=72,
arguments_list_p=0x7fffffffdb64, arguments_list_len=1) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:343
#18 0x0000000000433115 in opfunc_call (frame_ctx_p=0x7fffffffdbb0) at jerryscript/jerry-core/vm/vm.c:425
#19 0x0000000000438002 in vm_execute (frame_ctx_p=0x7fffffffdbb0, arg_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2804
#20 0x0000000000438289 in vm_run (bytecode_header_p=0x695438 <jerry_global_heap+504>, this_binding_value=27,
lex_env_p=0x695268 <jerry_global_heap+40>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0)
at jerryscript/jerry-core/vm/vm.c:2884
#21 0x0000000000432d75 in vm_run_global (bytecode_p=0x695438 <jerry_global_heap+504>) at jerryscript/jerry-core/vm/vm.c:232
#22 0x00000000004598f1 in jerry_run (func_val=195) at jerryscript/jerry-core/api/jerry.c:558
#23 0x0000000000458400 in main (argc=3, argv=0x7fffffffded8) at jerryscript/jerry-main/main-unix.c:656
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'ecma_is_value_empty (completion_value)' failed in vm_var_decl | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2105/comments | 1 | 2017-11-16T08:51:11Z | 2017-12-25T09:43:05Z | https://github.com/jerryscript-project/jerryscript/issues/2105 | 274,437,010 | 2,105 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7692aa9d
Build command: ./tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
var value;
Object.defineProperty (Array.prototype, 'then', {get: function() { throw$ } })
promise = Promise.all ([])
promise.then (
function() {},
function(val) {
if (val !== value) ;
})
```
###### Backtrace:
```
ICE: Assertion '!ecma_is_value_direct (x) || ecma_is_value_undefined (x) || ecma_is_value_null (x) || ecma_is_value_boolean (x) || ecma_is_value_integer_number (x)' failed at jerryscript/jerry-core/ecma/operations/ecma-comparison.c(ecma_op_strict_equality_compare):205.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0xf7fd5db9 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7fd5db9 in __kernel_vsyscall ()
#1 0xf7816352 in raise () from /lib32/libc.so.6
#2 0xf7817a51 in abort () from /lib32/libc.so.6
#3 0x56574406 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x565e331b in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x565e335c in jerry_assert_fail (
assertion=0x56682420 "!ecma_is_value_direct (x) || ecma_is_value_undefined (x) || ecma_is_value_null (x) || ecma_is_value_boolean (x) || ecma_is_value_integer_number (x)", file=0x56682340 "jerryscript/jerry-core/ecma/operations/ecma-comparison.c",
function=0x56675740 <__func__.2776.lto_priv.213> "ecma_op_strict_equality_compare", line=205)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x56581626 in ecma_op_strict_equality_compare (x=24, y=72) at jerryscript/jerry-core/ecma/operations/ecma-comparison.c:201
#7 0x56604dc6 in vm_loop (frame_ctx_p=0xffffcb10) at jerryscript/jerry-core/vm/vm.c:1922
#8 0x5660a0bc in vm_execute (frame_ctx_p=0xffffcb10, arg_p=0xf5d000d4, arg_list_len=1) at jerryscript/jerry-core/vm/vm.c:2795
#9 0x5660a960 in vm_run (bytecode_header_p=0xf5f009d0, this_binding_value=4126149459, lex_env_p=0xf5d007b0, is_eval_code=false,
arg_list_p=0xf5d000d4, arg_list_len=1) at jerryscript/jerry-core/vm/vm.c:2884
#10 0x566141f5 in ecma_op_function_call (func_obj_p=0xf5f00250, this_arg_value=72, arguments_list_p=0xf5d000d4, arguments_list_len=1)
at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:406
#11 0x56616526 in ecma_process_promise_reaction_job (obj_p=0xf5d000d0)
at jerryscript/jerry-core/ecma/operations/ecma-jobqueue.c:170
#12 0x566172d4 in ecma_process_all_enqueued_jobs () at jerryscript/jerry-core/ecma/operations/ecma-jobqueue.c:344
#13 0x5664e892 in jerry_run_all_enqueued_jobs () at jerryscript/jerry-core/api/jerry.c:596
#14 0x5664b773 in main (argc=3, argv=0xffffd094) at jerryscript/jerry-main/main-unix.c:797
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion '!ecma_is_value_direct (x) || ecma_is_value_undefined (x) || ecma_is_value_null (x) || ecma_is_value_boolean (x) || ecma_is_value_integer_number (x)' failed in ecma_op_strict_equality_compare | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2104/comments | 2 | 2017-11-16T08:48:18Z | 2018-01-09T13:43:30Z | https://github.com/jerryscript-project/jerryscript/issues/2104 | 274,436,247 | 2,104 |
[
"jerryscript-project",
"jerryscript"
] | During the scripting of target build test automation for Travis CI (#2102), several issues have been identified:
- [ ] ESP8266:
- The apt dependencies list was overly extensive (at least compared to what Travis CI had already installed on the worker image), sometimes even erroneous (e.g., didn't have to install any `libc6-dev*` packages and actually couldn't install `libtool-bin` because such a package was not available).
- The creation of the `/opt/Espressif` directory is described together with the `dependencies` step although it belongs to the crosstool-NG building step. Moreover, it should be noted that neither the building of ct-ng nor the execution of ct-ng to build a cross toolchain requires elevated privileges (it can be done somewhere in the user's home directory, not under `/opt` only).
- Building crosstool-NG didn't work for me exactly as described, `make` detected recursion and bailed out.
- When building the firmware with JerryScript, why must `BIN_PATH` be specified? Couldn't it have at least a default to be the same as `BUILD_DIR`?
- [ ] Mbed OS 5:
- The target needs heavy maintenance. As is, building an example app or a library from sources present under `targets/mbedos5` with the Makefile is not possible. `make all` errors because there is no `main` in the code base, `make library` errors because launcher sources require `jerry-targetjs.h` that are explicitly not generated for libraries. Then the readme suggests to do a gulp-based build, but that build system uses a pinned JerryScript version (https://github.com/ARMmbed/mbed-js-gulp/blob/master/main.js, `const JERRYSCRIPT_REVISION = '5cdb98c75ec231806677a8af0b16d508b1033eb2';`) not master. So that seems never building with latest jerry. The target should always be able to test latest developments.
- [ ] NuttX:
- The readme doesn't mention which version of NuttX was last seen working. (7.22 worked for me, see makefile.)
- The readme doesn't describe how configuration can be automated (without menuconfig that requires user interaction). Moreover, the readme suggests fetching the kconfig sources from a "3rd party" while the nuttx/tools repo contains its own kconfig sources.
- [ ] Particle: I couldn't get it to build at all.
- [ ] RIOT:
- The readme doesn't pin the last known working version of RIOT. (2017.10 worked for me.)
- [ ] Tizen RT:
- The readme doesn't pin the last known working version of Tizen RT. (1.1_Public_Release worked for me but only if I adapted the romfs patch.)
- PPA-based GCC6 version worked, too (readme mentions GCC4.9, but that just seems to be a lower bound, not a must).
- [ ] Zephyr:
- The readme doesn't pin the last known working version of Zephyr, which is quite an issue. Zephyr has changed build system on master to something cmake-based, which is completely incompatible with the code in `targets/zephyr` right now. For me, Zephyr 1.9.1 and Zephyr SDK 0.9.1 worked. (But even in this release, Zephyr doesn't seem to have the readme-suggested `qemu` make target anymore.)
- Non-interactive installation required quite some recursive digging into self-extracting archives within self-extracting archives, because documentation suggests interactive installation of the SDK by "ansering all questions" (out of question on Travis).
- Directory structure suggested by readme has `zephyr-project`, although when I clone it out from github, it will be named `zephyr` by default.
- Calling make with `./targets/zephyr/Makefile.zephyr` fails to build the JerryScript library with quite weird errors... unless you set CC to point deep within the Zephyr SDK: `zephyr-sdk-0.9.1/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elfiamcu/i586-zephyr-elfiamcu-gcc`. Which is not documented anywhere and was a hell to debug. Note: zephyr sets its the build environment for its own build system up by sourcing `zephyr-env.sh`, but JerryScript's build system will know nothing about that. And `Makefile.zepyhr` will use `$CC` which is usually still set to the native compiler.
It would be great if target maintainers could check these out.
| Outdated or incorrect build instructions for several targets | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2103/comments | 2 | 2017-11-16T08:45:26Z | 2018-01-10T09:31:20Z | https://github.com/jerryscript-project/jerryscript/issues/2103 | 274,435,522 | 2,103 |
[
"jerryscript-project",
"jerryscript"
] | Hi Guys,
I'm want to use JerryScript on Nuttx. I've created a RAMDISK using mkrd, then I used echo in order to create a file with a .js extension, but when I run jerry /mnt/fs/test.js, I got a message saying :
Error: cannot open file: test.js
Source file load error
the test.js file is just a console.log . | JerryScript issue on Nuttx | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2098/comments | 9 | 2017-11-14T15:02:59Z | 2019-12-02T14:10:27Z | https://github.com/jerryscript-project/jerryscript/issues/2098 | 273,823,873 | 2,098 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 6b1ed6e0
Build command: CC=clang ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --jerry-libc=off --static-link=off --lto=off --error-messages=on
```
###### OS:
```
Ubuntu 17.10
macOS High Sierra (10.13.1)
```
###### Test case:
It seems that jerry produces the same failure with any kind of syntax errors when compiling it with clang. E.g.:
```javascript
function a() {
```
###### Backtrace:
```
=================================================================
==1467==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0xff934fcb at pc 0x080abfde bp 0xff934f88 sp 0xff934b60
READ of size 12 at 0xff934fcb thread T0
#0 0x80abfdd in __interceptor_strcmp.part.32 crtstuff.c:?
#1 0x816f8e3 in jerry_value_is_syntax_error jerryscript/jerry-main/main-unix.c:122
#2 0x816e8e9 in print_unhandled_exception jerryscript/jerry-main/main-unix.c:154 (discriminator 1)
#3 0x816d99f in main jerryscript/jerry-main/main-unix.c:790
#4 0xf7be3985 in __libc_start_main ??:?
#5 0x806e177 in _start ??:?
Address 0xff934fcb is located in stack of thread T0
SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow crtstuff.c:? in __interceptor_strcmp.part.32
Shadow bytes around the buggy address:
0x3ff269a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff269b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff269c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff269d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff269e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x3ff269f0: 00 00 00 00 ca ca ca ca 00[03]cb cb cb cb cb cb
0x3ff26a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff26a10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff26a20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff26a30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ff26a40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==1467==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| dynamic-stack-buffer-overflow in jerry_value_is_syntax_error | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2094/comments | 2 | 2017-11-14T09:15:57Z | 2017-11-20T08:14:47Z | https://github.com/jerryscript-project/jerryscript/issues/2094 | 273,717,562 | 2,094 |
[
"jerryscript-project",
"jerryscript"
] | After updating Zephyr to master, JerryScript will no longer build, since Zephyr now has changed to build with cmake:
$ make -f targets/zephyr/Makefile.zephyr
targets/zephyr/Makefile.zephyr:47: build/arduino_101/zephyr/Makefile.export: No such file or directory
make -f ./targets/zephyr/Makefile O="build/arduino_101/zephyr" V= USER_LIBS="jerry-core jerry-ext" USER_LIB_INCLUDE_DIR="-L /home/jimmy/projects/zephyrjs/zephyr.js/deps/jerryscript/build/arduino_101/obj-arduino_101/lib" TARGET_ZEPHYR=./targets/zephyr initconfig
make[1]: Entering directory '/home/jimmy/projects/zephyrjs/zephyr.js/deps/jerryscript'
targets/zephyr/Makefile:60: /home/jimmy/projects/zephyrjs/zephyr.js/deps/zephyr/Makefile.inc: No such file or directory
make[1]: *** No rule to make target '/home/jimmy/projects/zephyrjs/zephyr.js/deps/zephyr/Makefile.inc'. Stop.
make[1]: Leaving directory '/home/jimmy/projects/zephyrjs/zephyr.js/deps/jerryscript'
targets/zephyr/Makefile.zephyr:103: recipe for target 'build/arduino_101/zephyr/include/config/auto.conf' failed
make: *** [build/arduino_101/zephyr/include/config/auto.conf] Error 2
| Zephyr target fails to build with latest Zephyr cmake changes | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2093/comments | 2 | 2017-11-13T20:55:50Z | 2018-09-21T08:33:35Z | https://github.com/jerryscript-project/jerryscript/issues/2093 | 273,574,678 | 2,093 |
[
"jerryscript-project",
"jerryscript"
] | Hi,
I want to build jerryscript for RIOT. If I try to build the source via
```
make -f ./targets/riot-stm32f4/Makefile.riot
```
I get the following errors
```c
[ 0%] Building C object jerry-core/CMakeFiles/jerry-core.dir/ecma/operations/ecma-regexp-object.c.obj
/home/frey/Desktop/Projects/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c: In function 're_match_regexp':
/home/frey/Desktop/Projects/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:747:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
{
^
/home/frey/Desktop/Projects/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:801:7: note: here
case RE_OP_CAPTURE_GROUP_START:
^~~~
/home/frey/Desktop/Projects/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:933:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
bc_p = old_bc_p;
~~~~~^~~~~~~~~~
/home/frey/Desktop/Projects/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:938:7: note: here
case RE_OP_CAPTURE_GREEDY_GROUP_END:
^~~~
cc1: some warnings being treated as errors
```
Compiling jerryscript via
```
python tools/build.py
```
works fine. Am I missing something?
Thanks in advance! | riot-stm32f4 fails to build | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2085/comments | 11 | 2017-11-10T13:32:56Z | 2018-02-05T15:18:22Z | https://github.com/jerryscript-project/jerryscript/issues/2085 | 272,933,470 | 2,085 |
[
"jerryscript-project",
"jerryscript"
] | Before PR #2042, `jerry_value_clear_error_flag` and `jerry_value_set_error_flag` would take a `jerry_value_t *` and set a flag onto it. After each of these calls return, the `jerry_value_t` that the pointer points to would still be a reference to the same JS thing as before.
After PR #2042, after the `jerry_value_set_error_flag` returns, the `jerry_value_t` is updated to reference a *different* value (the error "box"). Same with `jerry_value_clear_error_flag`, it expects to take an `jerry_value_t *` pointing to such an error "box" and after the call returns, the `jerry_value_t` will contain the unboxed value.
Even though this change is source and binary compatible, semantically it's not compatible (and thus breaking the API, IMHO).
One of the more serious implications is that the client code needs to be aware of the "swapping" of the `jerry_value_t`:
Contrived example:
```
jerry_value_t sth = ...;
sth = jerry_acquire_value(sth); // this worked fine before #2042
jerry_value_set_error_flag(&sth);
// Whoops! After PR #2042 the boxed value is not acquired...
return sth;
```
Unless we really need to free up the error flag bit in the `jerry_value_t` *now*, I'd revert #2042, I'm afraid it will break people's projects in unexpected ways. At the very least, the docs should be updated – this change is more than a transparent implementation detail.
If the freed up bit is actually really needed now, perhaps create a new API with a name that better matches what happens under the hood, mark the old one deprecated. The old one can call the new implementation, but at least this way there's a mechanism to get people's attention after pulling from upstream.
cc @zherczeg @akosthekiss | Changes from #2042 break semantic API compatibility | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2080/comments | 10 | 2017-11-09T14:13:24Z | 2018-02-16T09:30:23Z | https://github.com/jerryscript-project/jerryscript/issues/2080 | 272,578,056 | 2,080 |
[
"jerryscript-project",
"jerryscript"
] | Hi Guys,
I want to build Jerryscript for NuttX on a NUCLEO-F401RE board.
I followed the instructions exactly in the https://github.com/jerryscript-project/jerryscript/tree/master/targets/nuttx-stm32f4 except for step 3, I used ./configure.sh nucleo-f4x1re/f401-nsh.
And when I try to build JerryScript for NuttX (Step 4) using :
cd nuttx/
make
I got this error :
make[2]: Leaving directory '/home/ubuntu/jerry-nuttx/nuttx/configs/nucleo-f4x1re/src'
LD: nuttx
arm-none-eabi-ld: /home/ubuntu/jerry-nuttx/nuttx/nuttx section `.bss' will not fit in region `sram'
arm-none-eabi-ld: region `sram' overflowed by 16492 bytes
Makefile:203: recipe for target 'nuttx' failed
make[1]: *** [nuttx] Error 1
make[1]: Leaving directory '/home/ubuntu/jerry-nuttx/nuttx/arch/arm/src'
Makefile.unix:416: recipe for target 'pass2' failed
make: *** [pass2] Error 2
I'm really struggling with this error
| arm-none-eabi-ld: region `sram' overflowed by 16492 bytes | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2077/comments | 7 | 2017-11-08T19:54:47Z | 2017-11-14T19:28:34Z | https://github.com/jerryscript-project/jerryscript/issues/2077 | 272,327,990 | 2,077 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: bdcd2d8
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
Date.parse("2015-01-01T01߄'a': 1}:01F");
```
[Download test case](https://github.com/jerryscript-project/jerryscript/files/1450939/test.txt)
###### Backtrace:
```
ICE: Assertion '(c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER' failed at jerryscript/jerry-core/lit/lit-strings.c(lit_read_code_unit_from_utf8):425.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x00000000005ffda8 in raise ()
(gdb) bt
#0 0x00000000005ffda8 in raise ()
#1 0x00000000005fff5d in abort ()
#2 0x00000000005956c1 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#3 jerry_fatal (code=code@entry=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#4 0x0000000000595db2 in jerry_assert_fail (assertion=assertion@entry=0x691be8 "(c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER",
file=file@entry=0x67e9e0 "jerryscript/jerry-core/lit/lit-strings.c",
function=function@entry=0x693770 <__func__.2487> "lit_read_code_unit_from_utf8", line=line@entry=425)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#5 0x0000000000596e9f in lit_read_code_unit_from_utf8 (buf_p=<optimized out>, code_point=<optimized out>)
at jerryscript/jerry-core/lit/lit-strings.c:425
#6 0x00000000005aede8 in lit_utf8_read_next (buf_p=0x7fffffffda08) at jerryscript/jerry-core/lit/lit-strings.c:467
#7 ecma_date_parse_date_chars (str_p=0x7fffffffda08, str_end_p=0x9c5f9a <jerry_global_heap+506> "", num_of_chars=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-date.c:60
#8 0x00000000005b523f in ecma_builtin_date_parse.isra.1.lto_priv.312 (arg=<optimized out>)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-date.c:269
#9 0x0000000000457051 in ecma_builtin_date_dispatch_routine (this_arg_value=219, arguments_number=1, arguments_list=0x7fffffffdc2c,
builtin_routine_id=<optimized out>) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h:33
#10 ecma_builtin_dispatch_routine (builtin_object_id=<optimized out>, builtin_routine_id=<optimized out>,
this_arg_value=this_arg_value@entry=219, arguments_list=arguments_list@entry=0x7fffffffdc2c, arguments_number=arguments_number@entry=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:153
#11 0x000000000045a95e in ecma_builtin_dispatch_call (obj_p=0x9c5e88 <jerry_global_heap+232>, this_arg_value=219,
arguments_list_p=0x7fffffffdc2c, arguments_list_len=1)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#12 0x00000000004ac44d in ecma_op_function_call (func_obj_p=0x9c5e88 <jerry_global_heap+232>, this_arg_value=<optimized out>,
arguments_list_p=0x7fffffffdc2c, arguments_list_len=1)
at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:343
#13 0x00000000005ca5ab in opfunc_call.isra.1 () at jerryscript/jerry-core/vm/vm.c:424
#14 vm_execute (frame_ctx_p=frame_ctx_p@entry=0x7fffffffdc40, arg_p=<optimized out>, arg_list_len=<optimized out>)
at jerryscript/jerry-core/vm/vm.c:2803
#15 0x00000000005dc396 in vm_run (bytecode_header_p=<optimized out>, this_binding_value=<optimized out>, lex_env_p=<optimized out>,
is_eval_code=<optimized out>, arg_list_p=<optimized out>, arg_list_len=<optimized out>)
at jerryscript/jerry-core/vm/vm.c:2883
#16 0x000000000040b5eb in vm_run_global (bytecode_p=<optimized out>) at jerryscript/jerry-core/vm/vm.c:231
#17 jerry_run (func_val=203) at jerryscript/jerry-core/api/jerry.c:558
#18 main (argc=<optimized out>, argv=<optimized out>) at jerryscript/jerry-main/main-unix.c:758
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion '(c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER' failed in lit_read_code_unit_from_utf8 | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2073/comments | 1 | 2017-11-07T17:14:58Z | 2017-11-15T07:12:43Z | https://github.com/jerryscript-project/jerryscript/issues/2073 | 271,913,289 | 2,073 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 678fcb20
Build command: ./tools/build.py --clean --debug --error-messages=on
```
###### OS:
```
Ubuntu 17.10
```
###### Test case:
```javascript
null[1] = 'abcd';
```
###### Backtrace:
```
Script Error: TypeError: Cannot set property '1' of null
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript/jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):181.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x00000000004760d8 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x00000000004760d8 in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040de02 in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:95
#2 0x000000000040ddd4 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x000000000040712d in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x0000000000448394 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x00000000004483e6 in jerry_assert_fail (assertion=0x47e638 "JERRY_CONTEXT (jmem_heap_allocated_size) == 0",
file=0x47e5c0 "jerryscript/jerry-core/jmem/jmem-heap.c",
function=0x488400 <__func__.3116.lto_priv.382> "jmem_heap_finalize", line=181)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x00000000004479ab in jmem_heap_finalize () at jerryscript/jerry-core/jmem/jmem-heap.c:181
#7 0x0000000000447620 in jmem_finalize () at jerryscript/jerry-core/jmem/jmem-allocator.c:51
#8 0x00000000004661da in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:220
#9 0x00000000004655be in main (argc=3, argv=0x7fffffffdf68) at jerryscript/jerry-main/main-unix.c:911
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator). </sup>
| Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed in jmem_heap_allocated_size | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2069/comments | 1 | 2017-11-03T13:49:31Z | 2017-11-06T14:48:06Z | https://github.com/jerryscript-project/jerryscript/issues/2069 | 270,984,045 | 2,069 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: d9cc3fd
Build command: ./tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
```javascript
var a = Promise.prototype;
for (var i = 0; i < 200; i++)
{
Promise.race([a]).then();
}
```
###### Backtrace:
```
ICE: Assertion 'object_p->type_flags_refs >= ECMA_OBJECT_REF_ONE' failed at jerryscript/jerry-core/ecma/base/ecma-gc.c(ecma_deref_object):143.
Error: ERR_FAILED_INTERNAL_ASSERTION
bt
#0 0x000000000059e248 in raise ()
#1 0x000000000059e45a in abort ()
#2 0x000000000057e4bd in jerry_port_fatal (code=25351) at jerryscript/jerry-port/default/default-fatal.c:71
#3 0x00000000004faeef in jerry_fatal (code=<optimized out>) at jerryscript/jerry-core/jrt/jrt-fatals.c:60
#4 0x00000000004fafe0 in jerry_assert_fail (assertion=0x6 <error: Cannot access memory at address 0x6>, file=0x59e248 <raise+56> "H=", function=0xb01880 "\200\030\260", line=<optimized out>) at jerryscript/jerry-core/jrt/jrt-fatals.c:84
#5 0x0000000000418742 in ecma_deref_object (object_p=<optimized out>) at jerryscript/jerry-core/ecma/base/ecma-gc.c:143
#6 0x00000000004dd48d in ecma_process_promise_reaction_job (obj_p=0xa87920 <jerry_global_heap+31728>) at jerryscript/jerry-core/ecma/operations/ecma-jobqueue.c:210
#7 0x00000000004ddcf9 in ecma_process_all_enqueued_jobs () at jerryscript/jerry-core/ecma/operations/ecma-jobqueue.c:344
#8 0x0000000000402f85 in main (argc=<optimized out>, argv=0x7fffffffd188) at jerryscript/jerry-main/main-unix.c:900
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/). </sup>
| Assertion 'object_p->type_flags_refs >= ECMA_OBJECT_REF_ONE' failed in ecma_deref_object | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2065/comments | 2 | 2017-10-29T14:20:46Z | 2017-12-12T03:40:25Z | https://github.com/jerryscript-project/jerryscript/issues/2065 | 269,402,789 | 2,065 |
[
"jerryscript-project",
"jerryscript"
] | Is there a Javascript interface to force Garbage Collection to happen in Jerryscript? I know there's a way to do it from the C perspective, but I can't find a way to do it in JS.
Other JS environments have ways to force garbage collection in JS. Opera's window.opera.collect() and Node's global.gc() are two examples. Does this concept exist in Jerryscript? | How To Force Garbage Collection | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2062/comments | 6 | 2017-10-27T06:56:03Z | 2017-10-29T18:10:42Z | https://github.com/jerryscript-project/jerryscript/issues/2062 | 269,005,968 | 2,062 |
[
"jerryscript-project",
"jerryscript"
] | ``` javascript
var p = Promise.resolve(1).then(function(x) {
print(x) // will print 1
return Promise.resolve(2)
}).then(function(x) {
print(x) // should print 2, but now this will not be executed
})
```
I will fix soon.
| promise bug: cannot handle thenable job | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2060/comments | 2 | 2017-10-27T05:11:19Z | 2017-11-01T01:53:59Z | https://github.com/jerryscript-project/jerryscript/issues/2060 | 268,989,946 | 2,060 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: d7c710d
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
```javascript
/?:/
```
###### Backtrace:
```
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript/jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):181.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0x0000000000471a0f in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
59 SYSCALL_2
(gdb) bt
#0 0x0000000000471a0f in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x00000000004028af in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:95
#2 0x0000000000402881 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000403d25 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000042e352 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000042e3a2 in jerry_assert_fail (assertion=0x479788 "JERRY_CONTEXT (jmem_heap_allocated_size) == 0",
file=0x4796f8 "jerryscript/jerry-core/jmem/jmem-heap.c",
function=0x488bc0 <__func__.3151.lto_priv.280> "jmem_heap_finalize", line=181)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x000000000042d772 in jmem_heap_finalize () at jerryscript/jerry-core/jmem/jmem-heap.c:181
#7 0x000000000042e05e in jmem_finalize () at jerryscript/jerry-core/jmem/jmem-allocator.c:51
#8 0x000000000046ff74 in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:220
#9 0x000000000046f3a3 in main (argc=3, argv=0x7fffffffd198) at jerryscript/jerry-main/main-unix.c:911
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/). </sup>
| Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed in jmem_heap_finalize | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2058/comments | 0 | 2017-10-26T08:35:18Z | 2017-10-31T14:47:20Z | https://github.com/jerryscript-project/jerryscript/issues/2058 | 268,672,476 | 2,058 |
[
"jerryscript-project",
"jerryscript"
] | Because `srand()` is not used on initialization. Without it, the `Math.random()` function generates the same results every time (not every call, but every time the environment runs).
This works on other JS engines like V8 (nodejs). IMHO we should look to achieve same results to be consistent with JS platform | Math.random() generates same results | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2053/comments | 8 | 2017-10-24T08:05:49Z | 2017-11-03T14:32:20Z | https://github.com/jerryscript-project/jerryscript/issues/2053 | 267,934,917 | 2,053 |
[
"jerryscript-project",
"jerryscript"
] | We're missing an argument transform for JS arrays.
Proposal / Sketch -- it's basically more or less the same as the object properties transform:
```
/**
* Validate the elements in the JS array and assign them to the native arguments.
*
* @return jerry undefined: all validators passed,
* jerry error: a validator failed.
*/
jerry_value_t
jerryx_arg_transform_array (const jerry_value_t js_array, /**< points to the JS array */
const jerryx_arg_t *c_arg_p, /**< points to the array of validation/transformation steps */
jerry_length_t c_arg_cnt); /**< the count of the `c_arg_p` array */
/**
* The structure used in jerryx_arg_array
*/
typedef struct
{
const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */
jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */
} jerryx_arg_array_props_t;
static inline jerryx_arg_t
jerryx_arg_array (const jerryx_arg_array_props_t *array_props_p, jerryx_arg_optional_t opt_flag);
``` | jerryx arg.h: add jerryx_arg_transform_array | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2046/comments | 3 | 2017-10-20T07:29:20Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/2046 | 267,086,479 | 2,046 |
[
"jerryscript-project",
"jerryscript"
] | Setting FEATURE_SYSTEM_ALLOCATOR for an x86_64 host build does not work.
jerry/jerry-core/jmem/jmem-allocator.c:69..72
>#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && defined (JERRY_CPOINTER_32_BIT)
> JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
>#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
> const uintptr_t heap_start = **(uintptr_t) &JERRY_HEAP_CONTEXT (first);**
The JERRY_HEAP_CONTEXT is used unless JERRY_CPOINTER_32_BIT has been set (OK) and ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY has been computed to true, which is not the case on LP64 programming model employed by GCC for x86_64.
The build process bails out with the following error:
>/opt/iotjs/deps/jerry/jerry-core/jmem/jmem-allocator.c: In function ‘jmem_compress_pointer’:
>/opt/iotjs/deps/jerry/jerry-core/jmem/jmem-allocator.c:72:45: error: implicit declaration of function >‘JERRY_HEAP_CONTEXT’ [-Werror=implicit-function-declaration]
> const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
I care for this setting, since I'd like to delve into valgrind verification of jerry/iotjs integration. With internal allocator that is opaque for valgrind, I'd need to annotate allocator functions for valgrind, which might be useful down the road, but just gets in the way now. | System allocator is not supported for x86_64 | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2041/comments | 4 | 2017-10-10T17:08:41Z | 2017-10-20T11:44:02Z | https://github.com/jerryscript-project/jerryscript/issues/2041 | 264,305,906 | 2,041 |
[
"jerryscript-project",
"jerryscript"
] | The "prototype" property of a function created with `jerry_create_external_function ()` is undefined. This means that one cannot construct classes and then expose them to JS.
We have `jerry_value_is_constructor ()` which allows one to determine if a value can be used as a constructor, and we have `jerry_construct_object ()` which allows one to instantiate a new object using an existing constructor, but we don't have `jerry_create_constructor (jerry_external_handler_t native_function_p)`, which would allow one to create a new constructor and then add properties to its prototype and static ones to the constructor itself.
My motivation is to implement N-API's [`napi_define_class ()`](https://docs.nodejs.org/dist/latest-v8.x/docs/api/n-api.html#n_api_napi_define_class).
Illustrated with a unit test:
```c
#include <string.h>
#include "test-common.h"
#include "jerryscript.h"
static jerry_value_t
native_function (const jerry_value_t function_obj,
const jerry_value_t this_val,
const jerry_value_t args_p[],
const jerry_value_t args_count)
{
(void) function_obj;
(void) this_val;
(void) args_p;
(void) args_count;
return jerry_create_undefined();
}
int
main (int argc, char **argv)
{
(void) argc;
(void) argv;
jerry_init (JERRY_INIT_EMPTY);
jerry_value_t js_native_function = jerry_create_external_function (native_function);
jerry_value_t global = jerry_get_global_object ();
jerry_value_t name = jerry_create_string ((jerry_char_t *) "native_function");
jerry_value_t set_result = jerry_set_property (global, name, js_native_function);
TEST_ASSERT (!jerry_value_has_error_flag (set_result));
char *js_code = "typeof native_function.prototype";
jerry_value_t parse_result = jerry_parse ((jerry_char_t *) js_code,
strlen (js_code),
true);
TEST_ASSERT (!jerry_value_has_error_flag (parse_result));
jerry_value_t eval_result = jerry_run (parse_result);
TEST_ASSERT (!jerry_value_has_error_flag (eval_result));
TEST_ASSERT (jerry_value_is_string (eval_result));
jerry_size_t result_size = jerry_get_string_size (eval_result);
jerry_char_t result_string[result_size + 1];
jerry_string_to_char_buffer (eval_result, result_string, result_size);
result_string[result_size] = 0;
TEST_ASSERT (!strcmp ((char *) result_string, "object"));
jerry_release_value (eval_result);
jerry_release_value (parse_result);
jerry_release_value (set_result);
jerry_release_value (name);
jerry_release_value (global);
jerry_release_value (js_native_function);
jerry_cleanup();
}
``` | native-backed functions have no "prototype" property | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2040/comments | 8 | 2017-10-10T11:14:28Z | 2018-02-16T10:34:55Z | https://github.com/jerryscript-project/jerryscript/issues/2040 | 264,189,156 | 2,040 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 1cc7cb5
Build command: ./tools/build.py --clean --debug --compile-flag=-m32 --jerry-libc=off --system-allocator=on --error-messages=on --profile=es2015-subset
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
[Download test case](https://github.com/jerryscript-project/jerryscript/files/1358492/test.txt)
###### Backtrace:
```
ICE: Assertion 'destination_p == destination_start_p + literal_p->length' failed at jerryscript/jerry-core/parser/js/js-lexer.c(lexer_construct_literal_object):1645.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
0xf7ffdbe9 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7ffdbe9 in __kernel_vsyscall ()
#1 0x080f9937 in raise ()
#2 0x080c0dc7 in abort ()
#3 0x0804d9f2 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x0806d861 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x0806d88f in jerry_assert_fail (assertion=0x813dd30 "destination_p == destination_start_p + literal_p->length",
file=0x813db18 "jerryscript/jerry-core/parser/js/js-lexer.c",
function=0x813717c <__func__.4295.lto_priv.297> "lexer_construct_literal_object", line=1645)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x080652ef in lexer_construct_literal_object (context_p=0xffffc008, literal_p=0xffffc0d0, literal_type=1 '\001')
at jerryscript/jerry-core/parser/js/js-lexer.c:1645
#7 0x08053ad9 in parser_parse_template_literal (context_p=0xffffc008)
at jerryscript/jerry-core/parser/js/js-parser-expr.c:601
#8 0x08053e7a in parser_parse_unary_expression.lto_priv.174 (context_p=0xffffc008, grouping_level_p=0xffffbf50)
at jerryscript/jerry-core/parser/js/js-parser-expr.c:745
#9 0x0804c6b8 in parser_parse_expression (context_p=0xffffc008, options=2)
at jerryscript/jerry-core/parser/js/js-parser-expr.c:1605
#10 0x08060882 in parser_parse_statements (context_p=0xffffc008) at jerryscript/jerry-core/parser/js/js-parser-statm.c:1977
#11 0x0806a0b2 in parser_parse_source (arg_list_p=0x0, arg_list_size=0, source_p=0x8186040 <buffer.lto_priv> "`", source_size=74, strict_mode=0,
error_location_p=0xffffc188) at jerryscript/jerry-core/parser/js/js-parser.c:2179
#12 0x0806abca in parser_parse_script (arg_list_p=0x0, arg_list_size=0, source_p=0x8186040 <buffer.lto_priv> "`", source_size=74, is_strict=false,
bytecode_data_p=0xffffc1f0) at jerryscript/jerry-core/parser/js/js-parser.c:2690
#13 0x080b73e2 in jerry_parse (source_p=0x8186040 <buffer.lto_priv> "`", source_size=74, is_strict=false)
at jerryscript/jerry-core/api/jerry.c:351
#14 0x080b7468 in jerry_parse_named_resource (resource_name_p=0xffffc6c9 "/home/reni/test.js", resource_name_length=18,
source_p=0x8186040 <buffer.lto_priv> "`", source_size=74, is_strict=false) at jerryscript/jerry-core/api/jerry.c:409
#15 0x080bae14 in main (argc=3, argv=0xffffc414) at jerryscript/jerry-main/main-unix.c:730
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/)</sup>
| Assertion 'destination_p == destination_start_p + literal_p->length' failed in lexer_construct_literal_object | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2039/comments | 0 | 2017-10-05T08:16:54Z | 2017-11-09T05:12:36Z | https://github.com/jerryscript-project/jerryscript/issues/2039 | 263,039,429 | 2,039 |
[
"jerryscript-project",
"jerryscript"
] | I am trying to build my project for STM32F429ZI and I have noticed an issue with generate_pins.py script. It fails while trying to evaluate expressions. For example, I am getting this error while building.
```
zMacBookPro:mbed-js-example zeeshan$ gulp --target=NUCLEO_F429ZI
[15:30:03] Using gulpfile ~/Programming/mbed/mbed-js-example/gulpfile.js
[15:30:03] Starting 'make-build-dir'...
[15:30:03] Finished 'make-build-dir' after 149 μs
[15:30:03] Starting 'makefile'...
[15:30:03] Starting 'bundle'...
[15:30:03] Starting 'ignorefile'...
[15:30:03] Finished 'makefile' after 50 ms
[15:30:03] Starting 'get-jerryscript'...
[15:30:03] Finished 'get-jerryscript' after 198 μs
[15:30:03] Starting 'getlibs'...
[15:30:03] Finished 'ignorefile' after 42 ms
[15:30:03] Finished 'getlibs' after 71 ms
$ make getlibs
make: Nothing to be done for `getlibs'.
[15:30:03] Finished 'bundle' after 138 ms
[15:30:03] Starting 'cppify'...
[15:30:03] Finished 'cppify' after 99 ms
[15:30:03] Starting 'build'...
[15:30:04] Found no native packages.
$ make BOARD=NUCLEO_F429ZI EXTRAS=
[15:30:04] build/make
[15:30:04] Finished 'build' after 1.44 s
[15:30:04] Starting 'default'...
[15:30:04] Finished 'default' after 42 μs
cd jerryscript/targets/mbedos5 && pip install -r tools/requirements.txt && rm -f source/js_encoded.cpp && rm -f source/pins.cpp && rm -f source/main.cpp && make BOARD=NUCLEO_F429ZI EXTRA_SRC="../../../source" EXTERN_BUILD_DIR=../../../out/NUCLEO_F429ZI NO_JS=1
Requirement already satisfied: pycparser<=2.17 in /Library/Python/2.7/site-packages (from -r tools/requirements.txt (line 1))
Requirement already satisfied: simpleeval in /Library/Python/2.7/site-packages (from -r tools/requirements.txt (line 2))
Requirement already satisfied: pycparserext in /Library/Python/2.7/site-packages (from -r tools/requirements.txt (line 3))
Requirement already satisfied: ply>=3.4 in /Library/Python/2.7/site-packages (from pycparserext->-r tools/requirements.txt (line 3))
python tools/generate_pins.py NUCLEO_F429ZI
Traceback (most recent call last):
File "tools/generate_pins.py", line 249, in <module>
main()
File "tools/generate_pins.py", line 239, in main
pins = enumerate_pins(pins_file, ['./tools'] + list(includes), defines)
File "tools/generate_pins.py", line 160, in enumerate_pins
return visitor.visit(parsed_ast)
File "tools/generate_pins.py", line 107, in visit
value = value or self.visit(child_node)
File "tools/generate_pins.py", line 107, in visit
value = value or self.visit(child_node)
File "tools/generate_pins.py", line 103, in visit
value = self.visit_typedecl(node)
File "tools/generate_pins.py", line 135, in visit_typedecl
pins[pin.name] = evaluator.eval(expr.strip())
File "/Library/Python/2.7/site-packages/simpleeval.py", line 274, in eval
return self._eval(ast.parse(expr.strip()).body[0].value)
File "/Library/Python/2.7/site-packages/simpleeval.py", line 285, in _eval
return handler(node)
File "/Library/Python/2.7/site-packages/simpleeval.py", line 307, in _eval_binop
return self.operators[type(node.op)](self._eval(node.left),
File "/Library/Python/2.7/site-packages/simpleeval.py", line 285, in _eval
return handler(node)
File "/Library/Python/2.7/site-packages/simpleeval.py", line 378, in _eval_name
raise NameNotDefined(node.id, self.expr)
simpleeval.NameNotDefined: 'PA_0' is not defined for expression 'PA_0 | ALT0'
make[1]: *** [source/pins.cpp] Error 1
make: *** [all] Error 2
events.js:182
throw er; // Unhandled 'error' event
^
Error: Command `make BOARD=NUCLEO_F429ZI EXTRAS=` exited with code 2
at ChildProcess.handleSubShellExit (/Users/zeeshan/Programming/mbed/mbed-js-example/node_modules/gulp-run/command.js:166:13)
at Object.onceWrapper (events.js:318:30)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
```
I have also tried building for REALTEK_RTL8195AM and I am getting similar errors:
```
zMacBookPro:mbed-js-example zeeshan$ gulp --target=REALTEK_RTL8195AM
[15:38:37] Using gulpfile ~/Programming/mbed/mbed-js-example/gulpfile.js
[15:38:37] Starting 'make-build-dir'...
[15:38:38] Finished 'make-build-dir' after 164 μs
[15:38:38] Starting 'makefile'...
[15:38:38] Starting 'bundle'...
[15:38:38] Starting 'ignorefile'...
[15:38:38] Finished 'makefile' after 40 ms
[15:38:38] Starting 'get-jerryscript'...
[15:38:38] Finished 'get-jerryscript' after 115 μs
[15:38:38] Starting 'getlibs'...
[15:38:38] Finished 'ignorefile' after 42 ms
[15:38:38] Finished 'getlibs' after 75 ms
$ make getlibs
make: Nothing to be done for `getlibs'.
[15:38:38] Finished 'bundle' after 130 ms
[15:38:38] Starting 'cppify'...
[15:38:38] Finished 'cppify' after 92 ms
[15:38:38] Starting 'build'...
[15:38:39] Found no native packages.
$ make BOARD=REALTEK_RTL8195AM EXTRAS=
[15:38:39] build/make
[15:38:39] Finished 'build' after 1.52 s
[15:38:39] Starting 'default'...
[15:38:39] Finished 'default' after 43 μs
cd jerryscript/targets/mbedos5 && pip install -r tools/requirements.txt && rm -f source/js_encoded.cpp && rm -f source/pins.cpp && rm -f source/main.cpp && make BOARD=REALTEK_RTL8195AM EXTRA_SRC="../../../source" EXTERN_BUILD_DIR=../../../out/REALTEK_RTL8195AM NO_JS=1
Requirement already satisfied: pycparser<=2.17 in /Library/Python/2.7/site-packages (from -r tools/requirements.txt (line 1))
Requirement already satisfied: simpleeval in /Library/Python/2.7/site-packages (from -r tools/requirements.txt (line 2))
Requirement already satisfied: pycparserext in /Library/Python/2.7/site-packages (from -r tools/requirements.txt (line 3))
Requirement already satisfied: ply>=3.4 in /Library/Python/2.7/site-packages (from pycparserext->-r tools/requirements.txt (line 3))
python tools/generate_pins.py REALTEK_RTL8195AM
Traceback (most recent call last):
File "tools/generate_pins.py", line 249, in <module>
main()
File "tools/generate_pins.py", line 239, in main
pins = enumerate_pins(pins_file, ['./tools'] + list(includes), defines)
File "tools/generate_pins.py", line 160, in enumerate_pins
return visitor.visit(parsed_ast)
File "tools/generate_pins.py", line 107, in visit
value = value or self.visit(child_node)
File "tools/generate_pins.py", line 107, in visit
value = value or self.visit(child_node)
File "tools/generate_pins.py", line 103, in visit
value = self.visit_typedecl(node)
File "tools/generate_pins.py", line 135, in visit_typedecl
pins[pin.name] = evaluator.eval(expr.strip())
File "/Library/Python/2.7/site-packages/simpleeval.py", line 274, in eval
return self._eval(ast.parse(expr.strip()).body[0].value)
File "/Library/Python/2.7/site-packages/simpleeval.py", line 285, in _eval
return handler(node)
File "/Library/Python/2.7/site-packages/simpleeval.py", line 307, in _eval_binop
return self.operators[type(node.op)](self._eval(node.left),
File "/Library/Python/2.7/site-packages/simpleeval.py", line 285, in _eval
return handler(node)
File "/Library/Python/2.7/site-packages/simpleeval.py", line 307, in _eval_binop
return self.operators[type(node.op)](self._eval(node.left),
File "/Library/Python/2.7/site-packages/simpleeval.py", line 285, in _eval
return handler(node)
File "/Library/Python/2.7/site-packages/simpleeval.py", line 378, in _eval_name
raise NameNotDefined(node.id, self.expr)
simpleeval.NameNotDefined: 'PORT_A' is not defined for expression '(PORT_A << 4) | 0'
make[1]: *** [source/pins.cpp] Error 1
make: *** [all] Error 2
events.js:182
throw er; // Unhandled 'error' event
^
Error: Command `make BOARD=REALTEK_RTL8195AM EXTRAS=` exited with code 2
at ChildProcess.handleSubShellExit (/Users/zeeshan/Programming/mbed/mbed-js-example/node_modules/gulp-run/command.js:166:13)
at Object.onceWrapper (events.js:318:30)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
```
For the time being, I am fixing my issue with STM32F429ZI by writing the following line in try statement:
```
try:
pins[pin.name] = evaluator.eval(expr.strip())
except:
print("[Error]. Problem while evaluation expression.")
```
The script runs fine for K64F and STM32F401RE boards which don't have expressions in their PinNames.h file. | Problem with generate_pins.py script in mbedos5 | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2038/comments | 2 | 2017-10-04T13:44:53Z | 2018-05-10T06:34:29Z | https://github.com/jerryscript-project/jerryscript/issues/2038 | 262,792,876 | 2,038 |
[
"jerryscript-project",
"jerryscript"
] | During the meeting it was discussed that other engines use an "error mode" rather than signal the error as a flag in the return value. The advantage of that approach is we can free up the flag bit in the jerry value, so new JS types such as symbols could be implemented. The drawback is a breaking API change. What shall we do? | New error management system for JerryScript | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2031/comments | 7 | 2017-09-29T06:16:14Z | 2018-05-10T10:12:45Z | https://github.com/jerryscript-project/jerryscript/issues/2031 | 261,541,565 | 2,031 |
[
"jerryscript-project",
"jerryscript"
] | I want to use mbed-cli debugger,so I edit __/mbed-js-example/build/jerryscript/targets/mbedos5__ -> __DEBUG?=1__
my commend is ```gulp --target=NUCLEO_F401RE```
but I got this error
```
Compile [100.0%]: test_env.cpp
Link: mbedos5
/usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: ../../../out/NUCLEO_F401RE/mbedos5.elf section `.text' will not fit in region `FLASH'
/usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 81380 bytes
collect2: error: ld returned 1 exit status
[ERROR] /usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: ../../../out/NUCLEO_F401RE/mbedos5.elf section `.text' will not fit in region `FLASH'
/usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 81380 bytes
collect2: error: ld returned 1 exit status
[mbed] ERROR: "/Users/Rozen_mac/anaconda/bin/python" returned error code 1.
[mbed] ERROR: Command "/Users/Rozen_mac/anaconda/bin/python -u /Users/Rozen_mac/code/node/mbed-js-example/build/jerryscript/targets/mbedos5/mbed-os/tools/make.py -t GCC_ARM -m NUCLEO_F401RE --profile ./mbed-os/tools/profiles/debug.json --source . --source ../../ --source ../../../source --build ../../../out/NUCLEO_F401RE -j0 -D CONFIG_MEM_HEAP_AREA_SIZE=(1024*16)" in "/Users/Rozen_mac/code/node/mbed-js-example/build/jerryscript/targets/mbedos5"
---
make[1]: *** [all] Error 1
make: *** [all] Error 2
events.js:160
throw er; // Unhandled 'error' event
^
Error: Command `make BOARD=NUCLEO_F401RE EXTRAS=` exited with code 2
at ChildProcess.handleSubShellExit (/Users/Rozen_mac/code/node/mbed-js-example/node_modules/gulp-run/command.js:166:13)
at ChildProcess.g (events.js:292:16)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
``` | mbed debugger error | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2030/comments | 9 | 2017-09-29T02:58:49Z | 2017-10-16T14:38:02Z | https://github.com/jerryscript-project/jerryscript/issues/2030 | 261,518,342 | 2,030 |
[
"jerryscript-project",
"jerryscript"
] | I am trying to take my javascript code (previously run in a browser) and run it from jerryscript. My JS code uses websockets libraries. Does jerryscript support this or any other network protocol library? | Does jerryscipt support Websockets JS library? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2029/comments | 10 | 2017-09-28T23:17:15Z | 2017-10-11T21:38:10Z | https://github.com/jerryscript-project/jerryscript/issues/2029 | 261,489,042 | 2,029 |
[
"jerryscript-project",
"jerryscript"
] | I see IoT.js use jerry_call_function in other thread not jerryscript thread, it is a right implementation?
I test that code and no error happen, but it lead to javascript code run in multiple thread, it is dangerous?
https://github.com/Samsung/iotjs/blob/master/src/platform/linux/iotjs_module_gpio-linux.c
line: 86 (iotjs_jhelper_call_ok is wrapper for jerry_call_function) | what happen when jerry_call_function called in other thread | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2023/comments | 5 | 2017-09-25T04:00:01Z | 2018-04-01T15:09:21Z | https://github.com/jerryscript-project/jerryscript/issues/2023 | 260,148,828 | 2,023 |
[
"jerryscript-project",
"jerryscript"
] | #### PoC and Crash in release 1.0.0
Assigned as CVE-2017-14749, Credit by ADLab of Venustech
PoC.js is as follows(hex displayed):
```
00000000: 275c 0a27 2b27 3035 3627 3b0a '\.'+'056';.
```
Among the first string, there is a '\n'(0x0a). This byte could be replaced by '\r'(0x0d) or other bytes as with a '\\' at front. And this kind of bytes makes the generated byte code contains an NULL word(0x00), which lead to a crash as the following stack trace shows:
```
#0 jmem_heap_alloc_block_internal (size=size@entry=0xb) at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/jmem/jmem-heap.c:250
#1 0x08051dcd in jmem_heap_gc_and_alloc_block (size=size@entry=0xb, ret_null_on_error=ret_null_on_error@entry=0x0)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/jmem/jmem-heap.c:346
#2 0x08059096 in jmem_heap_alloc_block (size=0xb) at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/jmem/jmem-heap.c:392
#3 ecma_concat_ecma_strings (string1_p=0x82899c0 <jerry_global_heap>, string2_p=0x8289b08 <jerry_global_heap+328>)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/ecma/base/ecma-helpers-string.c:459
#4 0x0806597a in opfunc_addition (left_value=0x82899c2, right_value=0x8289b0a)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/vm/opcodes-ecma-arithmetics.c:142
#5 0x08073d95 in vm_loop (frame_ctx_p=frame_ctx_p@entry=0xffffcce8)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/vm/vm.c:1641
#6 0x08074c48 in vm_execute (frame_ctx_p=frame_ctx_p@entry=0xffffcce8, arg_p=<optimized out>, arg_list_len=<optimized out>)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/vm/vm.c:2579
#7 0x08074e67 in vm_run_with_inline_stack (frame_ctx_p=frame_ctx_p@entry=0xffffcce8, arg_p=<optimized out>, arg_list_len=<optimized out>)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/vm/vm.c:2624
#8 0x08074f13 in vm_run (bytecode_header_p=0x8289b48 <jerry_global_heap+392>, this_binding_value=0x82899db,
lex_env_p=0x82899e8 <jerry_global_heap+40>, is_eval_code=0x0, arg_list_p=0x0, arg_list_len=0x0)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/vm/vm.c:2696
#9 0x08074f58 in vm_run_global (bytecode_p=0x8289b48 <jerry_global_heap+392>)
at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/vm/vm.c:208
#10 0x08074fa5 in jerry_run (func_val=<optimized out>) at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-core/jerry.c:355
#11 0x08048d82 in main (argc=0x2, argv=0xffffd064) at /home/default/Desktop/jerryscript-jerryscript-release-1.0.0/jerry-main/main-unix.c:396
#12 0xf7e16637 in __libc_start_main (main=0x80487cf <main>, argc=0x2, argv=0xffffd064, init=0x8079360 <__libc_csu_init>,
fini=0x80793c0 <__libc_csu_fini>, rtld_fini=0xf7fe88a0 <_dl_fini>, stack_end=0xffffd05c) at ../csu/libc-start.c:291
#13 0x0804912d in _start ()
```
#### Root cause
When processing the strings, the generated byte code are as follows:
```
b vm.c:669
668 uint8_t *byte_code_p = frame_ctx_p->byte_code_p;
669 jmem_cpointer_t *literal_start_p = frame_ctx_p->literal_start_p;
crash:
08289b54 [00 00 29 00] 86 00 01 08 46 00 00 00 ff ff ff ff
08289b64 60 fe 07 00 00 00 00 00 00 00 00 00 00 00 00 00
08289b74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08289b84 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
normal:
08289b6c [32 00 29 00] 86 00 01 08 46 00 00 00 ff ff ff ff
08289b7c 48 fe 07 00 00 00 00 00 00 00 00 00 00 00 00 00
08289b8c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
08289b9c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
```
The NULL word in 0x00290000 is one of the bytecode.literal compressed pointer. When bytecode is executed, the reference of the literal add 0x10 while jerry_global_heap.next_offset was overwritten because of the compressed pointer. Twice as it was referenced so the field was added up to 0x20. This makes the index of the free chunk lists corrupts.
#### Potential Risks
With the heap memory corruption the free chunk lists could be faked. Potentially there exists an local write primitive in memory. If jerry is embedded in some host and could execute js, this vulnerability could result in remote code execution.
#### Fix Suggestion
Check code in bytecode generation: the failed literal's compressed pointer should not be NULL word.
| Security: NULL word of bytecode.literal lead to heap memory corruption results in OOB write. | https://api.github.com/repos/jerryscript-project/jerryscript/issues/2008/comments | 2 | 2017-09-07T07:48:07Z | 2017-10-30T20:56:19Z | https://github.com/jerryscript-project/jerryscript/issues/2008 | 255,845,370 | 2,008 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7905422
Build command: ./tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
```javascript
var a = Promise.resolve();
for (;;)
Promise.race([a]).then()
$
```
###### Backtrace:
```
ICE: Assertion 'compressed_pointer != JMEM_CP_NULL' failed at jerryscript/jerry-core/jmem/jmem-allocator.c(jmem_decompress_pointer):96.
Error: ERR_FAILED_INTERNAL_ASSERTION
bt
#0 0x000000000047971f in syscall_2 () at jerryscript/jerry-libc/target/posix/jerry-asm.S:59
#1 0x000000000040489e in raise (sig=6) at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:95
#2 0x0000000000404870 in abort () at jerryscript/jerry-libc/target/posix/jerry-libc-target.c:81
#3 0x0000000000406dc4 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-port/default/default-fatal.c:71
#4 0x000000000042aa80 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5 0x000000000042aad0 in jerry_assert_fail (assertion=0x480c18 "compressed_pointer != JMEM_CP_NULL", file=0x480b38 "jerryscript/jerry-core/jmem/jmem-allocator.c", function=0x494750 <__func__.3185.lto_priv.290> "jmem_decompress_pointer", line=96) at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6 0x000000000042a8ce in jmem_decompress_pointer (compressed_pointer=0) at jerryscript/jerry-core/jmem/jmem-allocator.c:96
#7 0x00000000004728d0 in ecma_collection_iterator_next (iterator_p=0x7fffffffc890) at jerryscript/jerry-core/ecma/base/ecma-helpers-values-collection.c:332
#8 0x0000000000473327 in ecma_gc_mark (object_p=0x6a4b00 <jerry_global_heap+6160>) at jerryscript/jerry-core/ecma/base/ecma-gc.c:282
#9 0x0000000000474187 in ecma_gc_run (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at jerryscript/jerry-core/ecma/base/ecma-gc.c:753
#10 0x0000000000474368 in ecma_free_unused_memory (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at jerryscript/jerry-core/ecma/base/ecma-gc.c:849
#11 0x000000000042aa04 in jmem_run_free_unused_memory_callbacks (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at jerryscript/jerry-core/jmem/jmem-allocator.c:148
#12 0x0000000000431582 in jmem_heap_gc_and_alloc_block.lto_priv.296 (size=8, ret_null_on_error=false) at jerryscript/jerry-core/jmem/jmem-heap.c:359
#13 0x000000000042a2e6 in jmem_heap_alloc_block (size=8) at jerryscript/jerry-core/jmem/jmem-heap.c:408
#14 0x000000000042a695 in jmem_pools_alloc (size=8) at jerryscript/jerry-core/jmem/jmem-poolman.c:102
#15 0x0000000000472b53 in ecma_alloc_collection_chunk () at jerryscript/jerry-core/ecma/base/ecma-alloc.c:85
#16 0x000000000047239c in ecma_append_to_values_collection (header_p=0x6a4b28 <jerry_global_heap+6200>, v=8123, do_ref_if_object=false) at jerryscript/jerry-core/ecma/base/ecma-helpers-values-collection.c:168
#17 0x0000000000437765 in ecma_promise_do_then (promise=6163, on_fulfilled=7891, on_rejected=7907, result_capability=6371) at jerryscript/jerry-core/ecma/operations/ecma-promise-object.c:700
#18 0x0000000000437943 in ecma_promise_then (promise=6163, on_fulfilled=7891, on_rejected=7907) at jerryscript/jerry-core/ecma/operations/ecma-promise-object.c:765
#19 0x0000000000445375 in ecma_builtin_promise_prototype_then (this_arg=6163, on_fulfilled=7891, on_rejected=7907) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c:51
#20 0x000000000044530f in ecma_builtin_promise_prototype_dispatch_routine (builtin_routine_id=58, this_arg_value=6163, arguments_list=0x7fffffffce5c, arguments_number=2) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h:31
#21 0x000000000046019c in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, builtin_routine_id=58, this_arg_value=6163, arguments_list=0x7fffffffce5c, arguments_number=2) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:467
#22 0x0000000000460334 in ecma_builtin_dispatch_call (obj_p=0x6a3d78 <jerry_global_heap+2696>, this_arg_value=6163, arguments_list_p=0x7fffffffce5c, arguments_list_len=2) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#23 0x000000000043c2ac in ecma_op_function_call (func_obj_p=0x6a3d78 <jerry_global_heap+2696>, this_arg_value=6163, arguments_list_p=0x7fffffffce5c, arguments_list_len=2) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:419
#24 0x00000000004203ef in opfunc_call.lto_priv.142 (frame_ctx_p=0x7fffffffcea0) at jerryscript/jerry-core/vm/vm.c:408
#25 0x000000000041286e in vm_execute (frame_ctx_p=0x7fffffffcea0, arg_p=0x0, arg_list_len=0) at jerryscript/jerry-core/vm/vm.c:2743
#26 0x0000000000412aef in vm_run (bytecode_header_p=0x6a3890 <jerry_global_heap+1440>, this_binding_value=27, lex_env_p=0x6a3320 <jerry_global_heap+48>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0) at jerryscript/jerry-core/vm/vm.c:2823
#27 0x000000000042005f in vm_run_global (bytecode_p=0x6a3890 <jerry_global_heap+1440>) at jerryscript/jerry-core/vm/vm.c:231
#28 0x0000000000477214 in jerry_run (func_val=259) at jerryscript/jerry-core/api/jerry.c:444
#29 0x0000000000476119 in main (argc=3, argv=0x7fffffffd188) at jerryscript/jerry-main/main-unix.c:707
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/)</sup>
| Assertion 'compressed_pointer != JMEM_CP_NULL' in jmem_decompress_pointer | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1997/comments | 1 | 2017-09-04T14:45:57Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/1997 | 255,062,387 | 1,997 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7905422
Build command: ./tools/build.py --clean --debug --profile=es2015-subset
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
```javascript
new Promise(function(f) {
f.apply()
})
```
###### Backtrace:
```
Program received signal SIGSEGV, Segmentation fault.
0x00000000004357e6 in ecma_promise_resolve_handler (function=419, this=72, argv=0x0, argc=0)
at jerryscript/jerry-core/ecma/operations/ecma-promise-object.c:290
290 if (argv[0] == promise)
bt
#0 0x00000000004357e6 in ecma_promise_resolve_handler (function=435, this=72, argv=0x0, argc=0) at jerryscript/jerry-core/ecma/operations/ecma-promise-object.c:290
#1 0x000000000043b049 in ecma_op_function_call (func_obj_p=0x96c100 <jerry_global_heap+432>, this_arg_value=72, arguments_list_p=0x0, arguments_list_len=0) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:501
#2 0x000000000040ffde in ecma_builtin_function_prototype_object_apply (this_arg=435, arg1=72, arg2=72) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:100
#3 0x000000000040fe9b in ecma_builtin_function_prototype_dispatch_routine (builtin_routine_id=59, this_arg_value=435, arguments_list=0x7fffffffc940, arguments_number=0) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h:41
#4 0x000000000045e882 in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, builtin_routine_id=59, this_arg_value=435, arguments_list=0x7fffffffc940, arguments_number=0) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:108
#5 0x000000000045eea9 in ecma_builtin_dispatch_call (obj_p=0x96c1d8 <jerry_global_heap+648>, this_arg_value=435, arguments_list_p=0x7fffffffc940, arguments_list_len=0) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#6 0x000000000043ae21 in ecma_op_function_call (func_obj_p=0x96c1d8 <jerry_global_heap+648>, this_arg_value=435, arguments_list_p=0x7fffffffc940, arguments_list_len=0) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:419
#7 0x000000000041ef61 in opfunc_call.lto_priv.245 (frame_ctx_p=0x7fffffffc980) at jerryscript/jerry-core/vm/vm.c:408
#8 0x0000000000413328 in vm_execute (frame_ctx_p=0x7fffffffc980, arg_p=0x7fffffffcb00, arg_list_len=1) at jerryscript/jerry-core/vm/vm.c:2743
#9 0x00000000004135a9 in vm_run (bytecode_header_p=0x96c200 <jerry_global_heap+688>, this_binding_value=27, lex_env_p=0x96bf80 <jerry_global_heap+48>, is_eval_code=false, arg_list_p=0x7fffffffcb00, arg_list_len=2) at jerryscript/jerry-core/vm/vm.c:2823
#10 0x000000000043afd1 in ecma_op_function_call (func_obj_p=0x96c080 <jerry_global_heap+304>, this_arg_value=72, arguments_list_p=0x7fffffffcb00, arguments_list_len=2) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:482
#11 0x0000000000435e33 in ecma_op_create_promise_object (executor=307, type=ECMA_PROMISE_EXECUTOR_FUNCTION) at jerryscript/jerry-core/ecma/operations/ecma-promise-object.c:519
#12 0x0000000000443e15 in ecma_builtin_promise_dispatch_construct (arguments_list_p=0x7fffffffcd34, arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c:686
#13 0x000000000045f561 in ecma_builtin_dispatch_construct (obj_p=0x96c060 <jerry_global_heap+272>, arguments_list_p=0x7fffffffcd34, arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:474
#14 0x000000000043b5b9 in ecma_op_function_construct (func_obj_p=0x96c060 <jerry_global_heap+272>, arguments_list_p=0x7fffffffcd34, arguments_list_len=1) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:681
#15 0x0000000000415f8f in opfunc_construct.lto_priv.244 (frame_ctx_p=0x7fffffffcd70) at jerryscript/jerry-core/vm/vm.c:466
#16 0x0000000000413364 in vm_execute (frame_ctx_p=0x7fffffffcd70, arg_p=0x0, arg_list_len=0) at jerryscript/jerry-core/vm/vm.c:2748
#17 0x00000000004135a9 in vm_run (bytecode_header_p=0x96c188 <jerry_global_heap+568>, this_binding_value=27, lex_env_p=0x96bf80 <jerry_global_heap+48>, is_eval_code=false, arg_list_p=0x0, arg_list_len=0) at jerryscript/jerry-core/vm/vm.c:2823
#18 0x000000000041ebd1 in vm_run_global (bytecode_p=0x96c188 <jerry_global_heap+568>) at jerryscript/jerry-core/vm/vm.c:231
#19 0x0000000000475d40 in jerry_run (func_val=259) at jerryscript/jerry-core/api/jerry.c:444
#20 0x0000000000474c37 in main (argc=3, argv=0x7fffffffd188) at jerryscript/jerry-main/main-unix.c:707
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/)</sup>
| Segmentation fault in ecma_promise_resolve_handler | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1996/comments | 1 | 2017-09-04T14:35:16Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/1996 | 255,059,751 | 1,996 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 7525006
Build command: ./tools/build.py --clean --debug --profile=es2015-subset --jerry-libc=off
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
```javascript
Promise.race([""]).$()
```
###### Backtrace:
```
Script Error: ReferenceError
ICE: Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c(ecma_free_string_list):43.
Error: ERR_FAILED_INTERNAL_ASSERTION
bt
#0 0x00000000004853e8 in raise ()
#1 0x00000000004855da in abort ()
#2 0x0000000000400b5d in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-port/default/default-fatal.c:71
#3 0x00000000004298c9 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#4 0x0000000000429919 in jerry_assert_fail (assertion=0x5267e0 "ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)", file=0x526780 "jerryscript/jerry-core/ecma/base/ecma-literal-storage.c", function=0x522d50 <__func__.3969.lto_priv.241> "ecma_free_string_list", line=43) at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#5 0x000000000040ef3b in ecma_free_string_list (string_list_p=0x96c148 <jerry_global_heap+504>) at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:43
#6 0x000000000040efbc in ecma_finalize_lit_storage () at jerryscript/jerry-core/ecma/base/ecma-literal-storage.c:60
#7 0x000000000046159b in ecma_finalize () at jerryscript/jerry-core/ecma/base/ecma-init-finalize.c:65
#8 0x0000000000478055 in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:179
#9 0x00000000004775b4 in main (argc=3, argv=0x7fffffffd188) at jerryscript/jerry-main/main-unix.c:837
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/)</sup>
| Assertion 'ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)' failed in ecma_free_string_list | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1995/comments | 1 | 2017-09-04T14:26:35Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/1995 | 255,057,498 | 1,995 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: ce18704
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
```javascript
parseFloat(Number.MAX_VALUE).toFixed(5);
```
###### Backtrace:
```
Program received signal SIGSEGV, Segmentation fault.
0x0000000000447bc3 in ecma_builtin_number_prototype_object_to_fixed (this_arg=393, arg=80)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c:648
648 } /* ecma_builtin_number_prototype_object_to_fixed */
bt
#0 0x0000000000447bc3 in ecma_builtin_number_prototype_object_to_fixed (this_arg=393, arg=80) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c:648
#1 0x3834323134383136 in ?? ()
#2 0x0000003836333835 in ?? ()
#3 0x000000010096c0f0 in ?? ()
#4 0x00007fffffffcd2c in ?? ()
#5 0x0000003d00000189 in ?? ()
#6 0x00007fffffffcb20 in ?? ()
#7 0x000000000045e84e in ecma_builtin_dispatch_routine (builtin_object_id=<error reading variable: Cannot access memory at address 0x323034303430352e>, builtin_routine_id=<error reading variable: Cannot access memory at address 0x323034303430352a>, this_arg_value=<error reading variable: Cannot access memory at address 0x3230343034303526>, arguments_list=<error reading variable: Cannot access memory at address 0x323034303430351a>, arguments_number=<error reading variable: Cannot access memory at address 0x3230343034303522>) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:91
Backtrace stopped: Cannot access memory at address 0x323034303430353a
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/)</sup>
| Segmentation fault in ecma_builtin_number_prototype_object_to_fixed | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1993/comments | 2 | 2017-09-04T09:30:15Z | 2017-11-10T14:14:25Z | https://github.com/jerryscript-project/jerryscript/issues/1993 | 254,985,222 | 1,993 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 0ef2418
Build command: ./tools/build.py --clean --debug
```
###### OS:
```
Ubuntu 16.04.3 LTS
```
###### Test case:
```javascript
unescape("%fnd")
```
[Download test case](https://github.com/jerryscript-project/jerryscript/files/1266743/test.txt)
###### Backtrace:
```
ICE: Assertion 'lit_is_valid_cesu8_string (string_p, string_size)' failed at jerryscript/jerry-core/ecma/base/ecma-helpers-string.c(ecma_new_ecma_string_from_utf8):154.
Error: ERR_FAILED_INTERNAL_ASSERTION
Program received signal SIGABRT, Aborted.
(gdb) bt
#0 0x00000000005e4d28 in raise ()
#1 0x00000000005e4eda in abort ()
#2 0x000000000057ec65 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION)
at jerryscript/jerry-port/default/default-fatal.c:71
#3 jerry_fatal (code=code@entry=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#4 0x000000000057f350 in jerry_assert_fail (assertion=<optimized out>, file=<optimized out>, function=<optimized out>, line=<optimized out>)
at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#5 0x000000000040eac9 in ecma_new_ecma_string_from_utf8 (string_p=0x9c6458 <jerry_global_heap+296> "%f\327ýd", string_size=5)
at jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:154
#6 0x00000000004b65c6 in ecma_builtin_global_object_unescape.isra.12 (arg=<optimized out>)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-global.c:1336
#7 ecma_builtin_global_dispatch_routine (builtin_routine_id=<optimized out>, this_arg_value=<optimized out>, arguments_list=<optimized out>,
arguments_number=<optimized out>) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h:215
#8 0x0000000000441430 in ecma_builtin_dispatch_routine.lto_priv.316 (builtin_object_id=<optimized out>, builtin_routine_id=<optimized out>,
this_arg_value=72, arguments_list=0x7fffffffcf44, arguments_number=<optimized out>)
at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:484
#9 0x000000000049dd72 in ecma_builtin_dispatch_call (obj_p=0x9c6440 <jerry_global_heap+272>, this_arg_value=72, arguments_list_p=0x7fffffffcf44,
arguments_list_len=1) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#10 0x0000000000571830 in ecma_op_function_call (func_obj_p=0x9c6440 <jerry_global_heap+272>, this_arg_value=72, arguments_list_p=0x7fffffffcf44,
arguments_list_len=1) at jerryscript/jerry-core/ecma/operations/ecma-function-object.c:419
#11 0x00000000005c5f7d in opfunc_call.isra.1 () at jerryscript/jerry-core/vm/vm.c:408
#12 vm_execute (frame_ctx_p=frame_ctx_p@entry=0x7fffffffcf50, arg_p=<optimized out>, arg_list_len=<optimized out>)
at jerryscript/jerry-core/vm/vm.c:2743
#13 0x00000000005cbbba in vm_run (bytecode_header_p=<optimized out>, this_binding_value=<optimized out>, lex_env_p=<optimized out>,
is_eval_code=<optimized out>, arg_list_p=<optimized out>, arg_list_len=<optimized out>)
at jerryscript/jerry-core/vm/vm.c:2823
#14 0x00000000004094b8 in vm_run_global (bytecode_p=0x9c6568 <jerry_global_heap+568>) at jerryscript/jerry-core/vm/vm.c:231
#15 jerry_run (func_val=259) at jerryscript/jerry-core/api/jerry.c:444
#16 main (argc=<optimized out>, argv=<optimized out>) at jerryscript/jerry-main/main-unix.c:707
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/)</sup> | Assertion 'lit_is_valid_cesu8_string (string_p, string_size)' failed in ecma_new_ecma_string_from_utf8 | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1990/comments | 1 | 2017-08-31T10:39:29Z | 2017-09-25T10:41:01Z | https://github.com/jerryscript-project/jerryscript/issues/1990 | 254,291,169 | 1,990 |
[
"jerryscript-project",
"jerryscript"
] | Hi,
I would like to nominate SangGyu Lee (glistening) to be a JerryScript committer. I trust him to follow our process. His patch list follows:
- Fix new ArrayBuffer(length) for variaous input (#1959)
- Implement typedarary.set(array, offset) (#1958)
- Change tizenrt-artik05x port reference board to artik053 (#1904)
- Fix build warning in jerry-ext/arg on tizenrt-artik05x (#1906)
- Don't allow supplementary character as identifier start or part (#1899)
- Handle negative zero in number multiplication (#1856)
- Add `setjmp` and `longjmp` functions for tizenrt-artik05x (#1825)
- Use external handlers in tizenrt-artik05x target (#1822)
- Include jerry-ext/handler only in nuttx-stm32f4 target (#1816)
- target: tizenrt-artik05x: Add missing jerry_port.c (#1786)
- target: tizenrt-artik05x: Initial porting (#1775)
- Fix maybe-uninitialized warning in ecma-objects.c (#1773) | Nominating SangGyu Lee (glistening) to be a JerryScript committer | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1986/comments | 9 | 2017-08-29T15:17:14Z | 2017-09-05T10:10:46Z | https://github.com/jerryscript-project/jerryscript/issues/1986 | 253,702,726 | 1,986 |
[
"jerryscript-project",
"jerryscript"
] | I noticed that certain features affect the snapshot output format (logically so):
- whether uncompressed / 32-bit pointers is enabled
- machine endianness
- js-parser-limits.h values – `PARSER_MAXIMUM_CODE_SIZE` affects the byte code generation. I'm not sure if any of the other parser limit values are relevant when loading a snapshot.
- whether `RegExp` literal templates are used in the snapshot (a JerryScript VM that is compiled w/o `RegExp` support will hit `JERRY_UNREACHABLE ()` when loading a snapshot with a regular expression template literal)
- probably more...?
Right now, there's no nice way to check whether a snapshot is really compatible before running it.
Would it make sense to add this information to the `jerry_snapshot_header_t`?
@LaszloLango also hinted on IRC at that the magic strings list may also cause snapshots to become different, but I did not observe this when comparing outputs. | Add relevant features/snapshot properties bitset to snapshot header | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1981/comments | 7 | 2017-08-25T20:22:36Z | 2017-10-12T17:49:20Z | https://github.com/jerryscript-project/jerryscript/issues/1981 | 253,008,488 | 1,981 |
[
"jerryscript-project",
"jerryscript"
] | I'm interested in having a JavaScript library / module that can take a JS source string and produce a JerryScript snapshot. At a previous company, we had built something like this, simply by using Emscripten to transpile the C code that produces snapshots into JS. The advantage is that such a library is very easily "portable" to other platforms (i.e. cloud, mobile, browser, etc.)
Any objections if I add an option to JerryScript's build system to produce such a library? | Add jerryscript-snapshot-compiler.js ? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1977/comments | 7 | 2017-08-23T14:49:03Z | 2019-10-25T18:54:42Z | https://github.com/jerryscript-project/jerryscript/issues/1977 | 252,310,618 | 1,977 |
[
"jerryscript-project",
"jerryscript"
] | There's a recursion bug in regex handling code
On Ubuntu 16.04.2,
$ python tools/build.py --compile-flag=-m32 --clean --jerry-libc=OFF --system-allocator ON --compile-flag=-ggdb3 --debug --link-lib mcheck
(gdb) shell cat x.js
''.match(/(){70000}/)
(gdb) r
Starting program: /afl/new/jerryscript/build/bin/jerry x.js
Program received signal SIGSEGV, Segmentation fault.
0x0805ed53 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fe158)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:375
375 ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
(gdb) where
#0 0x0805ed53 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fe158)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:375
#1 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fe308)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#2 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fe4b8)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#3 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fe668)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#4 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fe818)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#5 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fe9c8)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#6 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7feb78)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#7 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7fed28)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#8 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7feed8)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#9 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7ff088)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#10 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7ff238)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#11 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7ff3e8)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#12 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7ff598)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987
#13 0x080604c8 in re_match_regexp.lto_priv.197 (re_ctx_p=0xffffd048, bc_p=0x8377f5a "\004\001", str_p=0x8127a6a "", out_str_p=0xff7ff748)
at /afl/new/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:987 | Out-of-stack-space DoS in regex code | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1975/comments | 1 | 2017-08-18T22:30:45Z | 2019-01-02T10:00:31Z | https://github.com/jerryscript-project/jerryscript/issues/1975 | 251,373,560 | 1,975 |
[
"jerryscript-project",
"jerryscript"
] | Only an assert stops this from being outside of the correct region. It seems that in most cases the result is pretty benign, but I wouldn't recommend relying on that.
On Ubuntu 16.04.2,
$ python tools/build.py --compile-flag=-m32 --clean --jerry-libc=OFF --system-allocator ON --compile-flag=-ggdb3 --debug --link-lib mcheck
$ cat x.js
39000000000000700 .toString(2);
(gdb) where
#0 jerry_assert_fail (assertion=0x8134df2 "buff_index <= buff_size", file=0x8134d60 "/afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c",
function=0x812dc40 <__func__.3568.lto_priv.293> "ecma_builtin_number_prototype_object_to_string", line=0x19e) at /afl/jerryscript/jerry-core/jrt/jrt-fatals.c:76
#1 0x0806c7ef in ecma_builtin_number_prototype_object_to_string.lto_priv.341 (this_arg=0x837be41, arguments_list_p=0xffffd38c, arguments_list_len=0x1)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c:414
#2 0x08072b84 in ecma_builtin_number_prototype_dispatch_routine (builtin_routine_id=0x22, this_arg_value=0x837be41, arguments_list=0xffffd38c, arguments_number=0x1)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h:34
#3 0x0809968d in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, builtin_routine_id=0x22, this_arg_value=0x837be41, arguments_list=0xffffd38c,
arguments_number=0x1) at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:91
#4 0x08099a87 in ecma_builtin_dispatch_call (obj_p=0x837c000, this_arg_value=0x837be41, arguments_list_p=0xffffd38c, arguments_list_len=0x1)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#5 0x08091f9e in ecma_op_function_call (func_obj_p=0x837c000, this_arg_value=0x837be41, arguments_list_p=0xffffd38c, arguments_list_len=0x1)
at /afl/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:458
#6 0x08085ce4 in opfunc_call.lto_priv.408 (frame_ctx_p=0xffffd3b4) at /afl/jerryscript/jerry-core/vm/vm.c:411
#7 0x0807db36 in vm_execute (frame_ctx_p=0xffffd3b4, arg_p=0x0, arg_list_len=0x0) at /afl/jerryscript/jerry-core/vm/vm.c:2746
#8 0x0807dcfe in vm_run (bytecode_header_p=0x837bfc0, this_binding_value=0x837bafb, lex_env_p=0x837bb30, is_eval_code=0x0, arg_list_p=0x0, arg_list_len=0x0)
at /afl/jerryscript/jerry-core/vm/vm.c:2826
#9 0x08085939 in vm_run_global (bytecode_p=0x837bfc0) at /afl/jerryscript/jerry-core/vm/vm.c:231
#10 0x080ae327 in jerry_run (func_val=0x837be0b) at /afl/jerryscript/jerry-core/api/jerry.c:425
#11 0x080ad1ce in main (argc=0x2, argv=0xffffd654) at /afl/jerryscript/jerry-main/main-unix.c:691
(gdb) print buff_index
$5 = 0x38
(gdb) print buff_size
$6 = 0x36 | ecma_builtin_number_prototype_object_to_string access outside of buffer region (005) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1974/comments | 0 | 2017-08-18T21:23:03Z | 2017-08-30T00:07:27Z | https://github.com/jerryscript-project/jerryscript/issues/1974 | 251,362,235 | 1,974 |
[
"jerryscript-project",
"jerryscript"
] | Seemingly infinite loop while trying to convert a string representing an exponential number to a number.
On Ubuntu 16.04.2,
$ python tools/build.py --compile-flag=-m32 --clean --jerry-libc=OFF --system-allocator ON --compile-flag=-ggdb3 --debug --link-lib mcheck
$ cat hang.js
777E7777777777-----00,');
$ MALLOC_CHECK_=1 gdb -q -x mcheck.gdb --args ./build/bin/jerry hang.js
Reading symbols from ./build/bin/jerry...done.
Breakpoint 1 at 0x80ac9a8: file /afl/jerryscript/jerry-main/main-unix.c, line 410.
Breakpoint 1, main (argc=0x2, argv=0xffffd644) at /afl/jerryscript/jerry-main/main-unix.c:410
410 {
$1 = 0x0
^C
Program received signal SIGINT, Interrupt.
0x080a049f in ecma_utf8_string_to_number (str_p=0x8178240 <buffer.lto_priv> "777E7777777777-----00,');\n", str_size=0xe) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-conversion.c:694
694 ECMA_NUMBER_CONVERSION_128BIT_INTEGER_DIV_10 (fraction_uint128);
(gdb) shell date
Fri Aug 18 13:57:58 PDT 2017
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x080a1097 in ecma_utf8_string_to_number (str_p=0x8178240 <buffer.lto_priv> "777E7777777777-----00,');\n", str_size=0xe) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-conversion.c:694
694 ECMA_NUMBER_CONVERSION_128BIT_INTEGER_DIV_10 (fraction_uint128);
(gdb) shell date
Fri Aug 18 13:58:31 PDT 2017
(gdb) where
#0 0x080a1097 in ecma_utf8_string_to_number (str_p=0x8178240 <buffer.lto_priv> "777E7777777777-----00,');\n", str_size=0xe)
at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-conversion.c:694
#1 0x080549cc in lexer_construct_number_object (context_p=0xffffd268, push_number_allowed=0x1, is_negative_number=0x0) at /afl/jerryscript/jerry-core/parser/js/js-lexer.c:1540
#2 0x0805263e in parser_parse_unary_expression.lto_priv.139 (context_p=0xffffd268, grouping_level_p=0xffffd1a0) at /afl/jerryscript/jerry-core/parser/js/js-parser-expr.c:529
#3 0x0804c242 in parser_parse_expression (context_p=0xffffd268, options=0x2) at /afl/jerryscript/jerry-core/parser/js/js-parser-expr.c:1363
#4 0x08058f70 in parser_parse_statements (context_p=0xffffd268) at /afl/jerryscript/jerry-core/parser/js/js-parser-statm.c:1981
#5 0x08089b77 in parser_parse_source.lto_priv.433 (source_p=0x8178240 <buffer.lto_priv> "777E7777777777-----00,');\n", size=0x1a, strict_mode=0x0, error_location_p=0xffffd3d4)
at /afl/jerryscript/jerry-core/parser/js/js-parser.c:2042
#6 0x080831a5 in parser_parse_script (source_p=0x8178240 <buffer.lto_priv> "777E7777777777-----00,');\n", size=0x1a, is_strict=0x0, bytecode_data_p=0xffffd410)
at /afl/jerryscript/jerry-core/parser/js/js-parser.c:2496
#7 0x080ae1ad in jerry_parse (source_p=0x8178240 <buffer.lto_priv> "777E7777777777-----00,');\n", source_size=0x1a, is_strict=0x0) at /afl/jerryscript/jerry-core/api/jerry.c:326
#8 0x080ae24d in jerry_parse_named_resource (name_p=0xffffd7bf "hang.js", name_length=0x7, source_p=0x8178240 <buffer.lto_priv> "777E7777777777-----00,');\n", source_size=0x1a, is_strict=0x0)
at /afl/jerryscript/jerry-core/api/jerry.c:381
#9 0x080ad197 in main (argc=0x2, argv=0xffffd644) at /afl/jerryscript/jerry-main/main-unix.c:682
(gdb)
| Hang while parsing string exponent to number (004) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1973/comments | 2 | 2017-08-18T21:01:54Z | 2017-10-27T10:32:44Z | https://github.com/jerryscript-project/jerryscript/issues/1973 | 251,357,919 | 1,973 |
[
"jerryscript-project",
"jerryscript"
] | Only an assert stops the function ecma_get_float_from_value from returning pointers from within an ecma value of the wrong type (it's not a float), which will happen in release builds because the assert is compiled out.
It's likely that this has a security impact.
On Ubuntu 16.04.2,
$ python tools/build.py --compile-flag=-m32 --clean --jerry-libc=OFF --system-allocator ON --compile-flag=-ggdb3 --debug --link-lib mcheck
$ cat ArrayLength.js
[].length={valueOf:function(){return Array.prototype.push(1),Object.freeze(Array.prototype);}}
$ MALLOC_CHECK_=1 gdb -q -x mcheck.gdb --args ./build/bin/jerry ArrayLength.js
<snip>
ICE: Assertion 'ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT' failed at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c(ecma_get_float_from_value):544.
Error: ERR_FAILED_INTERNAL_ASSERTION
[Inferior 1 (process 9992) exited with code 0170]
(gdb) where
#0 ecma_get_number_from_value (value=0x82d58e7) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:562
#1 0x080911ad in ecma_op_array_object_set_length (object_p=0x82d43f0, new_value=0x82d44ab, flags=0x0) at /afl/jerryscript/jerry-core/ecma/operations/ecma-array-object.c:170
#2 0x0808e1fa in ecma_op_object_put (object_p=0x82d43f0, property_name_p=0x82d4520, value=0x82d44ab, is_throw=0x0)
at /afl/jerryscript/jerry-core/ecma/operations/ecma-objects.c:707
#3 0x080858c7 in vm_op_set_value.lto_priv.413 (object=0x82d43f3, property=0x82d4522, value=0x82d44ab, is_strict=0x0) at /afl/jerryscript/jerry-core/vm/vm.c:186
#4 0x08082bcd in vm_loop.lto_priv.409 (frame_ctx_p=0xffffd3f4) at /afl/jerryscript/jerry-core/vm/vm.c:2492
#5 0x0807db1e in vm_execute (frame_ctx_p=0xffffd3f4, arg_p=0x0, arg_list_len=0x0) at /afl/jerryscript/jerry-core/vm/vm.c:2737
#6 0x0807dd0d in vm_run (bytecode_header_p=0x82d44d8, this_binding_value=0x82d406b, lex_env_p=0x82d40a0, is_eval_code=0x0, arg_list_p=0x0, arg_list_len=0x0)
at /afl/jerryscript/jerry-core/vm/vm.c:2826
#7 0x08085948 in vm_run_global (bytecode_p=0x82d44d8) at /afl/jerryscript/jerry-core/vm/vm.c:231
#8 0x080ae336 in jerry_run (func_val=0x82d437b) at /afl/jerryscript/jerry-core/api/jerry.c:425
#9 0x080ad1dd in main (argc=0x2, argv=0xffffd664) at /afl/jerryscript/jerry-main/main-unix.c:691
| Type confusion in release builds while setting array length from not a number (003) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1972/comments | 1 | 2017-08-18T20:47:36Z | 2017-08-31T06:18:53Z | https://github.com/jerryscript-project/jerryscript/issues/1972 | 251,354,910 | 1,972 |
[
"jerryscript-project",
"jerryscript"
] | There's a string validity check but it gets compiled out during release builds. Struck me that this validity check should probably happen in release builds also - so an if as well as an assert.
On Ubuntu 16.04.2,
$ python tools/build.py --compile-flag=-m32 --clean --jerry-libc=OFF --system-allocator ON --compile-flag=-ggdb3 --debug --link-lib mcheck
$ xxd unescape.js
0000000: 756e 6573 6361 7065 2827 2025 7201 3d3d unescape(' %r.==
0000010: 0001 0822 0909 6e20 7b31 7d74 e59c ac38 ..."..n {1}t...8
0000020: 4000 004d 6100 2409 092e 716e 7065 2e76 @..Ma.$...qnpe.v
0000030: 6159 7565 4f46 2030 2020 2020 2020 2020 aYueOF 0
0000040: 2020 2063 5e5e 5e5e 5e5e 5e5e 5e5e 5e5e c^^^^^^^^^^^^
0000050: 5e5e 5e5e 5e5e 5e5e 525e 5e5e 5e5e 5e5e ^^^^^^^^R^^^^^^^
0000060: 5e5e 5e5e 5e5e 6552 7a65 0108 2216 096e ^^^^^^eRze.."..n
0000070: 74e5 9cac 3840 0000 4d61 6f6e 0b64 2729 [email protected]')
0000080: 3b
$ gdb -q --args ./build/bin/jerry ../jerryscript-js/build/bin/crash-payloads/unescape.js
<snip>
(gdb) step
154 JERRY_ASSERT (lit_is_valid_cesu8_string (string_p, string_size));
(gdb) list
149 ecma_string_t *
150 ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 string */
151 lit_utf8_size_t string_size) /**< string size */
152 {
153 JERRY_ASSERT (string_p != NULL || string_size == 0);
154 JERRY_ASSERT (lit_is_valid_cesu8_string (string_p, string_size));
155
156 lit_magic_string_id_t magic_string_id = lit_is_utf8_string_magic (string_p, string_size);
157
158 if (magic_string_id != LIT_MAGIC_STRING__COUNT)
(gdb) where
#0 ecma_new_ecma_string_from_utf8 (string_p=0x837c048 " %r\001==", string_size=0x72) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:154
#1 0x08070952 in ecma_builtin_global_object_unescape.lto_priv.355 (this_arg=0x48, arg=0x837bfaa) at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-global.c:1336
#2 0x0807572e in ecma_builtin_global_dispatch_routine (builtin_routine_id=0x2c, this_arg_value=0x48, arguments_list=0xffffd374, arguments_number=0x1)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h:215
#3 0x08099927 in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_GLOBAL, builtin_routine_id=0x2c, this_arg_value=0x48, arguments_list=0xffffd374, arguments_number=0x1)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:484
#4 0x08099a87 in ecma_builtin_dispatch_call (obj_p=0x837be40, this_arg_value=0x48, arguments_list_p=0xffffd374, arguments_list_len=0x1)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#5 0x08091f9e in ecma_op_function_call (func_obj_p=0x837be40, this_arg_value=0x48, arguments_list_p=0xffffd374, arguments_list_len=0x1)
at /afl/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:458
#6 0x08085ce4 in opfunc_call.lto_priv.408 (frame_ctx_p=0xffffd394) at /afl/jerryscript/jerry-core/vm/vm.c:411
#7 0x0807db36 in vm_execute (frame_ctx_p=0xffffd394, arg_p=0x0, arg_list_len=0x0) at /afl/jerryscript/jerry-core/vm/vm.c:2746
#8 0x0807dcfe in vm_run (bytecode_header_p=0x837bf68, this_binding_value=0x837bafb, lex_env_p=0x837bb30, is_eval_code=0x0, arg_list_p=0x0, arg_list_len=0x0)
at /afl/jerryscript/jerry-core/vm/vm.c:2826
#9 0x08085939 in vm_run_global (bytecode_p=0x837bf68) at /afl/jerryscript/jerry-core/vm/vm.c:231
#10 0x080ae327 in jerry_run (func_val=0x837be0b) at /afl/jerryscript/jerry-core/api/jerry.c:425
#11 0x080ad1ce in main (argc=0x2, argv=0xffffd634) at /afl/jerryscript/jerry-main/main-unix.c:691
(gdb)
| String parsing issue: validity checks only in debug builds (002) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1971/comments | 1 | 2017-08-18T00:06:32Z | 2017-08-30T12:26:56Z | https://github.com/jerryscript-project/jerryscript/issues/1971 | 251,105,798 | 1,971 |
[
"jerryscript-project",
"jerryscript"
] | There's an exploitable heap corruption bug, where the garbage collector runs off the end of a bound function object and enters whatever else is after that. Owing to a sanity check on the arguments, this is super exploitable although I don't have an exploit for it.
On Ubuntu 16.04.2,
$ python tools/build.py --compile-flag=-m32 --clean --jerry-libc=OFF --system-allocator ON --compile-flag=-ggdb3 --debug --link-lib mcheck
$ cat x.js
Function.prototype.bind({0:0},30000000000);
$ cat mcheck.gdb
break main
commands
call mcheck(0)
c
end
run
$ MALLOC_CHECK_=1 gdb -q -x mcheck.gdb --args ./build/bin/jerry x.js
Reading symbols from ./build/bin/jerry...done.
Breakpoint 1 at 0x80ac9a8: file /afl/jerryscript/jerry-main/main-unix.c, line 410.
Breakpoint 1, main (argc=0x2, argv=0xffffd654) at /afl/jerryscript/jerry-main/main-unix.c:410
410 {
$1 = 0x0
Program received signal SIGSEGV, Segmentation fault.
0x080a8d7f in ecma_gc_set_object_visited.lto_priv.626 (object_p=0x93939390, is_visited=0x1) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:115
115 object_p->type_flags_refs = (uint16_t) (object_p->type_flags_refs & ~ECMA_OBJECT_FLAG_GC_VISITED);
(gdb) where
#0 0x080a8d7f in ecma_gc_set_object_visited.lto_priv.626 (object_p=0x93939390, is_visited=0x1) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:115
#1 0x080a2731 in ecma_gc_mark (object_p=0x837c150) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:348
#2 0x080a3054 in ecma_gc_run (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:732
#3 0x080a3220 in ecma_free_unused_memory (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:828
#4 0x0808be2e in jmem_run_free_unused_memory_callbacks (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at /afl/jerryscript/jerry-core/jmem/jmem-allocator.c:148
#5 0x0808c0b2 in jmem_heap_gc_and_alloc_block (size=0x8, ret_null_on_error=0x0) at /afl/jerryscript/jerry-core/jmem/jmem-heap.c:359
#6 0x0808c175 in jmem_heap_alloc_block (size=0x8) at /afl/jerryscript/jerry-core/jmem/jmem-heap.c:408
#7 0x0808bec9 in jmem_pools_alloc (size=0x8) at /afl/jerryscript/jerry-core/jmem/jmem-poolman.c:102
#8 0x0809bfb6 in ecma_alloc_number () at /afl/jerryscript/jerry-core/ecma/base/ecma-alloc.c:83
#9 0x0809b2fd in ecma_create_float_number (ecma_number=300000000) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:384
#10 0x0809b961 in ecma_copy_value (value=0x837c0f1) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:639
#11 0x0809ba79 in ecma_copy_value_if_not_object (value=0x837c0f1) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:683
#12 0x08074bd2 in ecma_builtin_function_prototype_object_bind (this_arg=0x837bb93, arguments_list_p=0xffffd38c, arguments_number=0x2)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:273
#13 0x08074513 in ecma_builtin_function_prototype_dispatch_routine (builtin_routine_id=0x25, this_arg_value=0x837bb93, arguments_list=0xffffd38c, arguments_number=0x2)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h:43
#14 0x080996c3 in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, builtin_routine_id=0x25, this_arg_value=0x837bb93, arguments_list=0xffffd38c,
arguments_number=0x2) at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:108
#15 0x08099a87 in ecma_builtin_dispatch_call (obj_p=0x837beb0, this_arg_value=0x837bb93, arguments_list_p=0xffffd38c, arguments_list_len=0x2)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#16 0x08091f9e in ecma_op_function_call (func_obj_p=0x837beb0, this_arg_value=0x837bb93, arguments_list_p=0xffffd38c, arguments_list_len=0x2)
at /afl/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:458
#17 0x08085ce4 in opfunc_call.lto_priv.408 (frame_ctx_p=0xffffd3b4) at /afl/jerryscript/jerry-core/vm/vm.c:411
#18 0x0807db36 in vm_execute (frame_ctx_p=0xffffd3b4, arg_p=0x0, arg_list_len=0x0) at /afl/jerryscript/jerry-core/vm/vm.c:2746
#19 0x0807dcfe in vm_run (bytecode_header_p=0x837bfe8, this_binding_value=0x837bafb, lex_env_p=0x837bb30, is_eval_code=0x0, arg_list_p=0x0, arg_list_len=0x0)
at /afl/jerryscript/jerry-core/vm/vm.c:2826
#20 0x08085939 in vm_run_global (bytecode_p=0x837bfe8) at /afl/jerryscript/jerry-core/vm/vm.c:231
#21 0x080ae327 in jerry_run (func_val=0x837be0b) at /afl/jerryscript/jerry-core/api/jerry.c:425
#22 0x080ad1ce in main (argc=0x2, argv=0xffffd654) at /afl/jerryscript/jerry-main/main-unix.c:691
(gdb)
The garbage collector is expecting a bound function to have an argument list, and it doesn't. Might have been an errant copy-paste between the compilation vs. the garbage collector.
More details from a similar debugging session:
Program received signal SIGSEGV, Segmentation fault.
0x080a8d7b in ecma_gc_set_object_visited.lto_priv.626 (object_p=0x93939390, is_visited=true) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:111
111 object_p->type_flags_refs = (uint16_t) (object_p->type_flags_refs | ECMA_OBJECT_FLAG_GC_VISITED);
(gdb) where
#0 0x080a8d7b in ecma_gc_set_object_visited.lto_priv.626 (object_p=0x93939390, is_visited=true) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:111
#1 0x080a2740 in ecma_gc_mark (object_p=0x82d7cf8) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:348
#2 0x080a3063 in ecma_gc_run (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:732
#3 0x080a322f in ecma_free_unused_memory (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at /afl/jerryscript/jerry-core/ecma/base/ecma-gc.c:828
#4 0x0808be3d in jmem_run_free_unused_memory_callbacks (severity=JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW) at /afl/jerryscript/jerry-core/jmem/jmem-allocator.c:148
#5 0x0808c0c1 in jmem_heap_gc_and_alloc_block (size=8, ret_null_on_error=false) at /afl/jerryscript/jerry-core/jmem/jmem-heap.c:359
#6 0x0808c184 in jmem_heap_alloc_block (size=8) at /afl/jerryscript/jerry-core/jmem/jmem-heap.c:408
#7 0x0808bed8 in jmem_pools_alloc (size=8) at /afl/jerryscript/jerry-core/jmem/jmem-poolman.c:102
#8 0x0809bfc5 in ecma_alloc_number () at /afl/jerryscript/jerry-core/ecma/base/ecma-alloc.c:83
#9 0x0809b30c in ecma_create_float_number (ecma_number=0.10000000000000001) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:384
#10 0x0809b970 in ecma_copy_value (value=137201113) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:639
#11 0x0809ba88 in ecma_copy_value_if_not_object (value=137201113) at /afl/jerryscript/jerry-core/ecma/base/ecma-helpers-value.c:683
#12 0x08074baa in ecma_builtin_function_prototype_object_bind (this_arg=137186523, arguments_list_p=0xffffd00c, arguments_number=158)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c:265
#13 0x08074522 in ecma_builtin_function_prototype_dispatch_routine (builtin_routine_id=37, this_arg_value=137186523, arguments_list=0xffffd00c, arguments_number=158)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h:43
#14 0x080996d2 in ecma_builtin_dispatch_routine (builtin_object_id=ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, builtin_routine_id=37, this_arg_value=137186523, arguments_list=0xffffd00c,
arguments_number=158) at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:108
#15 0x08099a96 in ecma_builtin_dispatch_call (obj_p=0x82d5730, this_arg_value=137186523, arguments_list_p=0xffffd00c, arguments_list_len=158)
at /afl/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:844
#16 0x08091fad in ecma_op_function_call (func_obj_p=0x82d5730, this_arg_value=137186523, arguments_list_p=0xffffd00c, arguments_list_len=158)
at /afl/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:458
#17 0x08085cf3 in opfunc_call.lto_priv.408 (frame_ctx_p=0xffffd3c4) at /afl/jerryscript/jerry-core/vm/vm.c:411
#18 0x0807db45 in vm_execute (frame_ctx_p=0xffffd3c4, arg_p=0x0, arg_list_len=0) at /afl/jerryscript/jerry-core/vm/vm.c:2746
#19 0x0807dd0d in vm_run (bytecode_header_p=0x82d6278, this_binding_value=137183339, lex_env_p=0x82d40a0, is_eval_code=false, arg_list_p=0x0, arg_list_len=0)
at /afl/jerryscript/jerry-core/vm/vm.c:2826
#20 0x08085948 in vm_run_global (bytecode_p=0x82d6278) at /afl/jerryscript/jerry-core/vm/vm.c:231
#21 0x080ae336 in jerry_run (func_val=137188227) at /afl/jerryscript/jerry-core/api/jerry.c:425
#22 0x080ad1dd in main (argc=2, argv=0xffffd634) at /afl/jerryscript/jerry-main/main-unix.c:691
ecma_gc_mark (object_p=0x82d7cf8). Well this is easier:
(gdb) print args_p[i]
$7 = 0x93939393
(gdb) print *(ecma_extended_object_t *)(0x82d7cf8)
$10 = {object = {type_flags_refs = 0x75, gc_next_cp = 0x0, property_list_or_bound_object_cp = 0x0, prototype_or_outer_reference_cp = 0x82d4100}, u = {built_in = {id = 0xd8,
length_and_bitset_size = 0x4c, routine_id = 0x82d, instantiated_bitset = {0x9e}}, class_prop = {class_id = 0x4cd8, u = {value = 0x9e, length = 0x9e}}, function = {scope_cp = 0x82d4cd8,
bytecode_cp = 0x9e}, array = {length = 0x82d4cd8, length_prop = 0x9e}, pseudo_array = {type = 0xd8, extra_info = 0x4c, u1 = {length = 0x82d, class_id = 0x82d}, u2 = {lex_env_cp = 0x9e,
arraybuffer = 0x9e}}, bound_function = {target_function = 0x82d4cd8, args_length = 0x9e}, external_handler_cb = 0x82d4cd8}}
So the 0x9e arguments list has come right out of the bytecode:
Breakpoint 7, opfunc_call.lto_priv.408 (frame_ctx_p=0xffffd3c4) at /afl/jerryscript/jerry-core/vm/vm.c:366
366 uint8_t opcode = frame_ctx_p->byte_code_p[0];
(gdb) print opcode
$27 = 0x0
(gdb) step
369 if (opcode >= CBC_CALL0)
(gdb) print opcode
$28 = 0xb2
(gdb) step
375 arguments_list_len = frame_ctx_p->byte_code_p[1];
(gdb) print frame_ctx_p
$29 = (vm_frame_ctx_t *) 0xffffd3c4
(gdb) print *frame_ctx_p
$30 = {
bytecode_header_p = 0x82d6278,
byte_code_p = 0x82d678e "\262\236(\025\004\062b*\022\020\t*\r\t'*\f\tC)\023\024\062b2\b)\f\t2b(\033\062",
byte_code_start_p = 0x82d6394 "*\001\002\003(\005\274\274\274", <incomplete sequence \314>,
registers_p = 0xffffd000,
stack_top_p = 0xffffd284,
literal_start_p = 0x82d6284,
lex_env_p = 0x82d40a0,
prev_context_p = 0x0,
this_binding = 0x82d406b,
call_block_result = 0x38,
context_depth = 0x0,
is_eval_code = 0x0,
call_operation = 0x1
}
(gdb) print frame_ctx_p->byte_code_p[1];
Invalid character ';' in expression.
(gdb) print frame_ctx_p->byte_code_p[1]
$31 = 0x9e
(gdb)
So now let's watch that... watch ((vm_frame_ctx_t *) 0xffffd3c4)->byte_code_p[1]
Finally some progress:
Hardware watchpoint 4: *0x82d6519
Old value = 0x93939393
New value = 0x9393939e
parser_post_processing (context_p=0xffffd2b8) at /afl/jerryscript/jerry-core/parser/js/js-parser.c:1784
1784 real_offset++;
(gdb)
The value for the arguments length is passed in via the bytecode - it's an opcode (the next one!) and it's stored in js-parser.c, on line 1711:
1710 /* Storing the opcode */
1711 *dst_p++ = opcode;
(gdb) print opcode
$32 = CBC_CALL_PROP_PUSH_RESULT
Okay, so it's something intrinsic with how the types match up between the compiler and the garbage collector.
Other triggers for the same bug:
Function.prototype.bind({0:0},300000000000000000000000,{0:function(){(0)}});
and
l=eval.bind(.1,function(){},800-9900,function(){},909,910,function(){},900,9000,990,908==901)
and
try{String(Number.MAX_VALUE)}catch(r){}assert("a"=="".replace(/$/,"a")),assert("a"=="".replace(/^/,"a"));var eval=eval.bind(.1,0==function(){})
and
y=assert(isNaN(RegExp("")));eval.bind(.1,0,function Error(){},8==9.18,99.100-998399.100,97100,9998,99.100,998,99.100-9980,989,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.18,99.100,99,999,6998,9100,9998,99.100,99,999,9998.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.100-100,99839999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,eval.bind(.1,0,function Error(){},8==9.18,99.100-998399.100,9998,99.100,function x(){},99.100,989,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.18,99.100,99,999,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.100-100,99839999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.18,99.100,99,999,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.100-100,998399-100,9998,99.100,99,999,6998,99.100,898,99.+00,999.100,999.100,98==9100,9998,93.100,99,994,9998,99.100,9988,99.10000,9998998,99.100,9988,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.1098399-100,998399-100,9998100,999.100,998,99.100-100,99839999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,998399-100,9998,99.100,99,999,6998,99.100,998,99.1100,98.100,99,9998,99.100,9),99.18,99.100,99,999,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.100-100,998399-100,9998,99.100,99,999,6998,99.100,898,99.+00,999.100,999.100,98==9100,9998,99.100,99,994,9998,99.100,9988,99.10000,9998998,99.100,9988,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.1098399-100,998399-100,9998100,999.100,999.100,function x(){},999.100,9991*0,99,9998,99.10098,99.100,999.1,999.1998399-100,998399-100,9998,99.100,99,999,6998,99.100,998,99.1100,98.100,99,9998,99.100,9),9998,99.100,function x(){},999.100,999100,99,9999.100,9998,9999.100,9998,99.100,function x(){},999.100,9991*0,99,9998,99.100,999.100,9998,99.100,998399-100,998399-100,9998,99.1009,9998,99.100,999.100,9998,99.18,99.100,99,999,6998,9100,9998,99.100,99,999,9998.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.100-100,99839999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,eval.bind(.1,0,function Error(){},8==9.18,99.100-998399.100,9998,99.100,function x(){},99.100,989,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.18,99.100,99,999,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.100-100,99839999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.18,99.100,99,999,6998,9100,9998,99.100,99,999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.100-100,998399-100,9998,99.100,99,999,6998,99.100,898,99.+00,999.100,999.100,98==9100,9998,93.100,99,994,9998,99.100,9988,99.10000,9998998,99.100,9988,99.10000,9998,99.100,function x(){},999.100,999100,99,9998,99.100,999.100,9998,99.1098399-100,998399-100,9998100,999.100,998,99.100-100,99839999,9998,99.100,998,99.10000,9998,99.100,function x(){},999.100,998399-100,9998,99.100,99,999,6998,99.100,998,99.1100,98.100,99,9998,99.100,9),99.18,99(999,6998,99.100,998,99.100,999.99,9998,99.100,function x(){},999.100,999100,99,9,9998,99.100,99,994,1) | Security relevant heap corruption while garbage collecting bound functions (001) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1970/comments | 1 | 2017-08-17T23:55:37Z | 2017-09-04T08:25:20Z | https://github.com/jerryscript-project/jerryscript/issues/1970 | 251,104,242 | 1,970 |
[
"jerryscript-project",
"jerryscript"
] | Hi, when I was trying to build jerryscript under arm-none-eabi-gcc, I found that the FALLTHRU comments need to placed after right brackets.
So here is the interesting part: I wrote a minor fix on this, but found it can't pass the vera++ check (which forced us to place FALLTHRU before right bracket).
| Under gcc v7.1.0, the FALLTHRU comments need to be placed differently | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1965/comments | 2 | 2017-08-13T03:21:51Z | 2017-08-24T15:14:58Z | https://github.com/jerryscript-project/jerryscript/issues/1965 | 249,849,410 | 1,965 |
[
"jerryscript-project",
"jerryscript"
] | I ran into a problem today where an object wasn't getting freed. It turned out this was because its native pointer struct held acquired references to "listener" functions which in turn were bound to a scope object that held the original object as a property. I had to dig deeply into the GC today to learn about these things; before I had assumed that once refcounts went to 0, it would be freed. But there are essentially these "weak references" of 10 different types I see in gc_mark().
Anyway, I had been expecting when the reference count went to zero I would get my type_info's free_cb() called and that was where I was releasing these listener functions. It seems to me now that for this kind of case, there should perhaps be release_cb() in the type_info as well. I'm thinking when my refcount drops to zero I could probably release my own references like this. But maybe I'm wrong, it's a bit confusing.
I could use advice if there's another way to solve this. Previously we had implemented a "hidden property" to store an array of listeners; so these were held by "property reference" and disappeared. But this hidden property implementation was also something of a hack of JerryScript and a clever JS user could maybe have accessed it. So another good way to solve this might be for JrS to provide a way to define properties on objects that are hidden to JS and visible only from C APIs. I wonder if others have desired these same things?
| Semi-circular references | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1963/comments | 20 | 2017-08-12T00:50:17Z | 2019-01-12T15:14:31Z | https://github.com/jerryscript-project/jerryscript/issues/1963 | 249,777,577 | 1,963 |
[
"jerryscript-project",
"jerryscript"
] | The definition of `new ArrayBuffer(length)` is changed in ES2017.
( I pushed #1959 before I recognise it. I would like to get opinions. )
For example,
`ES2015`
_new ArrayBuffer(1.1)_ should throw RangeError.
`ES2017`
_new ArrayBuffer(1.1)_ creates ArrayBuffer with byteLength=1.
I would like to follow ES2017's definition.
Major engines (v8/spidermonkey/jsc) already work like ES2017 spec. ( Or ES specification may be updated to follow major engines. [ES2016](https://www.ecma-international.org/ecma-262/7.0/index.html#sec-arraybuffer-length) specification was same to ES2015. ).
| ES2015 or ES2017 for new ArrayBuffer(length) | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1962/comments | 3 | 2017-08-11T19:46:15Z | 2017-08-17T01:21:13Z | https://github.com/jerryscript-project/jerryscript/issues/1962 | 249,730,395 | 1,962 |
[
"jerryscript-project",
"jerryscript"
] | Apologies if there is some way to do this that I have missed. But it seems like it would be quite useful for debugging to have a method like:
uint16_t jerry_get_ref_count(jerry_value_t obj);
I've managed to create a macro that hacks my way to this information but it will likely break with future changes to JrS and probably only works for my specific build conditions.
| Request: API to get current ref count | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1961/comments | 5 | 2017-08-11T16:53:42Z | 2018-06-07T13:24:03Z | https://github.com/jerryscript-project/jerryscript/issues/1961 | 249,691,284 | 1,961 |
[
"jerryscript-project",
"jerryscript"
] | See https://github.com/jerryscript-project/jerryscript/blob/master/jerry-ext/include/jerryscript-ext/module.h#L51
`module_name` is stringified, which will cause the argument to not be evaluated by the preprocessor but used verbatim.
After having used the macro in practice, I found that it's not desirable to stringify it, because:
- it prevents one from creating macros that call the `JERRYX_NATIVE_MODULE` macro and pass in a variable module name
- it makes it impossible to single-source the module name, i.e. I cannot write something like:
```
#define MY_MODULE_NAME my_module
#define MY_MODULE_NAME_STR STRINGIFY(MY_MODULE_NAME)
void
foo (void)
{
const jerry_value_t m = call_require(MY_MODULE_NAME_STR);
// ...
}
// module will actually be named "MY_MODULE_NAME"...
JERRYX_NATIVE_MODULE(MY_MODULE_NAME, ...)
```
Therefore I propose to remove the stringification (`#`) from the macro.
I realize it's a breaking change, but the API is pretty new and the migration path is super simple.
Thoughts @gabrielschulhof ?
cc @jiangzidong | Remove stringification of JERRYX_NATIVE_MODULE module_name argument? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1952/comments | 6 | 2017-08-03T08:53:12Z | 2017-09-22T10:35:41Z | https://github.com/jerryscript-project/jerryscript/issues/1952 | 247,635,758 | 1,952 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 2a2a15f
Build command: ./tools/build.py --clean --debug --profile=es2015-subset --compile-flag=-m32 --system-allocator=on --jerry-libc=off --error-messages=on
```
###### OS:
```
Ubuntu 16.04.2 LTS
```
###### Test case:
```javascript
-''
```
###### Backtrace:
```
ICE: Assertion 'size > 0' failed at jerryscript//jerry-core/jmem/jmem-heap.c(jmem_heap_free_block):439.
Error: ERR_FAILED_INTERNAL_ASSERTION
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [Grammarinator](https://github.com/renatahodovan/grammarinator)</sup>
| Assertion 'size > 0' failed in jmem_heap_free_block | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1950/comments | 0 | 2017-08-01T18:23:25Z | 2017-08-01T18:28:24Z | https://github.com/jerryscript-project/jerryscript/issues/1950 | 247,158,438 | 1,950 |
[
"jerryscript-project",
"jerryscript"
] | I think it would be nice if the `jerry-core.h` API would have C APIs that match JSON.parse/stringify.
Proposal API:
```
typedef jerry_value_t (*jerry_json_reviver_t) (jerry_value_t key, jerry_value_t value);
jerry_value_t
jerry_json_parse_utf8 (const jerry_char_t *utf8_str,
size_t str_sz,
jerry_json_reviver_t reviver);
typedef jerry_value_t (*jerry_json_replacer_t) (jerry_value_t key, jerry_value_t value);
jerry_value_t
jerry_json_stringify(jerry_value_t value,
jerry_json_replacer_t replacer,
jerry_value_t space);
```
Note the output of `jerry_json_stringify` is not a UTF-8 C string (`jerry_char_t[]`). Although in most cases you probably want a C string...:
1. how to allocate the buffer for the C string?
2. what's an elegant way to deal with any errors – perhaps a `jerry_value_t *error_out`?
Thoughts? | JSON.parse/stringify C APIs? | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1949/comments | 4 | 2017-08-01T14:05:17Z | 2019-01-12T11:26:53Z | https://github.com/jerryscript-project/jerryscript/issues/1949 | 247,080,686 | 1,949 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 6fe4d06
Build command: ./tools/build.py --clean --debug --profile=es2015-subset --compile-flag=-m32 --system-allocator=on --jerry-libc=off --error-messages=on
```
###### OS:
```
Ubuntu 16.04.2 LTS
```
###### Test case:
```javascript
function $ ( ) { function $ ( ) { switch ( $ ? $ : \u018E ) {} } }
```
###### Backtrace:
```
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript//jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):184.
Error: ERR_FAILED_INTERNAL_ASSERTION
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [Grammarinator](https://github.com/renatahodovan/grammarinator)</sup>
| in jmem_heap_finalize | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1948/comments | 0 | 2017-08-01T13:32:04Z | 2017-08-01T13:32:39Z | https://github.com/jerryscript-project/jerryscript/issues/1948 | 247,070,284 | 1,948 |
[
"jerryscript-project",
"jerryscript"
] | ###### Jerry version:
```
Checked revision: 6fe4d06
Build command: ./tools/build.py --clean --debug --profile=es2015-subset --compile-flag=-m32 --system-allocator=on --jerry-libc=off --error-messages=on
```
###### OS:
```
Ubuntu 16.04.2 LTS
```
###### Test case:
```javascript
function $ ( ) { function $ ( ) { switch ( $ ? $ : \u018E ) {} } }
```
###### Backtrace:
```
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript//jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):184.
Error: ERR_FAILED_INTERNAL_ASSERTION
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [Grammarinator](https://github.com/renatahodovan/grammarinator)</sup>
| Assertion failed in jmem_heap_finalize | https://api.github.com/repos/jerryscript-project/jerryscript/issues/1947/comments | 2 | 2017-08-01T13:32:01Z | 2017-09-07T00:42:11Z | https://github.com/jerryscript-project/jerryscript/issues/1947 | 247,070,267 | 1,947 |
Subsets and Splits