jerryscript-project / jerryscript

Ultra-lightweight JavaScript engine for the Internet of Things.
https://jerryscript.net
Apache License 2.0
6.91k stars 669 forks source link

Memory Leak in Number Proxy #4988

Open anbu1024 opened 2 years ago

anbu1024 commented 2 years ago
JerryScript revision

0d4969661810b9e618485c284c361e597144e9b9

Build platform

Ubuntu 20.04.4 LTS

Build steps
python tools/build.py --debug --logging=on --error-messages=on --line-info=on 
Test case
var f = function () {}

let x = {
    get: function (theTarget, propName) {
        return 0;
    }
};

let p = new Proxy(Number, x);

try {
    let n = new p(f);
} catch (e) {
    print(e);
}

print('exit ...');
Execution steps
build/bin/jerry poc.js
Output
TypeError: Incorrect value is returned by a Proxy 'get' trap
exit ...
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript/jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):108.
Error: JERRY_FATAL_FAILED_ASSERTION
Aborted