mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-30 05:31:10 +00:00
!4996 Bugfix on BuiltinsRegExp::FlagsBitsToString which flagsStr is OOB
Merge pull request !4996 from chenjingxiang/regexp_flags_br
This commit is contained in:
commit
00f08f521d
@ -1949,7 +1949,7 @@ JSTaggedValue BuiltinsRegExp::FlagsBitsToString(JSThread *thread, uint8_t flags)
|
||||
{
|
||||
ASSERT((flags & 0x80) == 0); // 0x80: first bit of flags must be 0
|
||||
BUILTINS_API_TRACE(thread, RegExp, FlagsBitsToString);
|
||||
uint8_t *flagsStr = new uint8_t[7]; // 7: maximum 6 flags + '\0'
|
||||
uint8_t *flagsStr = new uint8_t[RegExpParser::FLAG_NUM + 1]; // FLAG_NUM flags + '\0'
|
||||
size_t flagsLen = 0;
|
||||
if (flags & RegExpParser::FLAG_HASINDICES) {
|
||||
flagsStr[flagsLen] = 'd';
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
static constexpr auto FLAG_UTF16 = (1U << 4U);
|
||||
static constexpr auto FLAG_STICKY = (1U << 5U);
|
||||
static constexpr auto FLAG_HASINDICES = (1U << 6U);
|
||||
static constexpr uint32_t FLAG_NUM = 7;
|
||||
static const uint32_t KEY_EOF = UINT32_MAX;
|
||||
static constexpr int CLASS_RANGE_BASE = 0x40000000;
|
||||
static constexpr uint32_t NUM_CAPTURE__OFFSET = 4;
|
||||
|
@ -30,3 +30,4 @@ dgm
|
||||
1,2
|
||||
1,2
|
||||
undefined
|
||||
dgimsuy
|
||||
|
@ -45,3 +45,6 @@ var result2 = "bπb".match(/(π)/du).indices;
|
||||
print(result2[0]);
|
||||
print(result2[1]);
|
||||
print(result2.groups);
|
||||
|
||||
var regexpFlags = new RegExp("", "dgimsuy").flags;
|
||||
print(regexpFlags);
|
Loading…
Reference in New Issue
Block a user