chakra-core / chakra-core/ChakraCore

[Bug]: The RegExp constructor does not raise a SyntaxError for octal escapes in Unicode mode

Open
#7,015 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

### ChakraCore Version

36becec

### Steps to reproduce

When using the `RegExp` constructor to create a regular expression with the `u` flag, if the pattern contains an octal escape sequence , the engine does not raise a `SyntaxError` according to the specification, but silently returns an invalid regular expression object. This behavior violates the ECMAScript standard.

### Proof of concept

```js
print(RegExp('[\\03]', 'u'));
```

### Exception or Error

```text
/[\03]/u
```

### Additional Context

The expected output should throw "SyntaxError".

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.