mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:07:35 +00:00
LibJS: Unescape incorrectly escaped code units in regex patterns
We were translating the pattern [\⪾-\⫀] to [\\u2abe-\\u2ac0], which is a very different pattern; as a code unit converted to the \uhhh format has no meaning when escaped, this commit makes us simply skip escaping it when translating the pattern.
This commit is contained in:
parent
35ff38aaea
commit
17087ac4a2
2 changed files with 22 additions and 3 deletions
|
@ -60,3 +60,9 @@ test("regexp literals are re-useable", () => {
|
|||
expect(re.test("test")).toBeTrue();
|
||||
}
|
||||
});
|
||||
|
||||
test("Incorrectly escaped code units not converted to invalid patterns", () => {
|
||||
const re = /[\⪾-\⫀]/;
|
||||
expect(re.test("⫀")).toBeTrue();
|
||||
expect(re.test("\\u2abe")).toBeFalse(); // ⫀ is \u2abe
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue