Skip to content

stack-overflow in ecma_regexp_match #3753

Closed
@owl337

Description

@owl337
JerryScript revision

bd1c4df

Build platform

Ubuntu 16.04.6 LTS (Linux 4.15.0-99-generic x86_64)

Build steps
python ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --lto=off --error-message=on --system-allocator=on
Test case
r = new RegExp ("(()*?)+?a");
assert (r.exec("ba")[0] == "a");
Output
ASAN:SIGSEGV
=================================================================
==103435==ERROR: AddressSanitizer: stack-overflow on address 0xff318fcc (pc 0x0808fc96 bp 0xff319158 sp 0xff318fb0 T0)
    #0 0x808fc95 in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:535
    #1 0x80915ee in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1060
    #2 0x80915ee in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1060
    #3 0x8091111 in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:995
    #4 0x8091b54 in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1122
    #5 0x80915ee in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1060
    #6 0x8091b54 in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1122
   ...
    #249 0x8091b54 in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1122
    #250 0x8091b54 in ecma_regexp_match /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:1122

SUMMARY: AddressSanitizer: stack-overflow /home/jerryscript/jerry-core/ecma/operations/ecma-regexp-object.c:535 ecma_regexp_match
==103435==ABORTING

Credits: This vulnerability is detected by chong from OWL337.

Metadata

Metadata

Assignees

Labels

bugUndesired behaviour

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions