LibRegex: Disallow duplicate named capture groups in ECMA262 parser

This commit is contained in:
davidot 2021-12-19 02:31:21 +01:00 committed by Linus Groh
commit 733a70671b
Notes: sideshowbarker 2024-07-17 22:31:10 +09:00
4 changed files with 11 additions and 0 deletions

View file

@ -2166,6 +2166,11 @@ bool ECMA262Parser::parse_capture_group(ByteCode& stack, size_t& match_length_mi
return false;
}
if (m_parser_state.named_capture_groups.contains(name)) {
set_error(Error::DuplicateNamedCapture);
return false;
}
ByteCode capture_group_bytecode;
size_t length = 0;
enter_capture_group_scope();