Skip to content

Commit 22d9183

Browse files
committed
Some further minor fixes
1 parent 8cb808e commit 22d9183

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868

6969
- name: Test (main test script)
7070
run: |
71-
ulimit -S -s 32768 # Raise stack limit; ASAN with -O0 is very stack-hungry
71+
ulimit -S -s 49152 # Raise stack limit; ASAN with -O0 is very stack-hungry
7272
./RunTest
7373
7474
- name: Test (JIT test program)

src/pcre2_compile.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6224,39 +6224,29 @@ for (;; pptr++)
62246224
too, we use a special-cased encoding of OP_ALLANY. */
62256225

62266226
if (op_info.op_single_type == ECL_ANY && allbitsone)
6227-
{
6228-
if (lengthptr == NULL) *code++ = OP_ALLANY;
6229-
}
6227+
*code++ = OP_ALLANY;
62306228

62316229
/* If the high bits are all matched / all not-matched, then we emit an
62326230
OP_NCLASS/OP_CLASS respectively. */
62336231

62346232
else if (op_info.op_single_type == ECL_ANY ||
62356233
op_info.op_single_type == ECL_NONE)
62366234
{
6237-
PCRE2_SIZE required_len = 1 + (32 / sizeof(PCRE2_UCHAR));
6238-
6239-
if (lengthptr != NULL)
6240-
{
6241-
/* Don't unconditionally request 32 more bytes - we probably already
6242-
reserved that much space inside compile_class_nested(). */
6243-
if (required_len > (*lengthptr - previous_length))
6244-
{
6245-
*lengthptr = previous_length + required_len;
6246-
}
6247-
}
6248-
else
6249-
{
6250-
*code++ = (op_info.op_single_type == ECL_ANY)? OP_NCLASS : OP_CLASS;
6251-
memcpy(code, op_info.bits.classbits, 32);
6252-
code += 32 / sizeof(PCRE2_UCHAR);
6253-
}
6235+
*code++ = (op_info.op_single_type == ECL_ANY)? OP_NCLASS : OP_CLASS;
6236+
memcpy(code, op_info.bits.classbits, 32);
6237+
code += 32 / sizeof(PCRE2_UCHAR);
62546238
}
62556239

62566240
/* Otherwise, we have an ECL_XCLASS, so we have the OP_XCLASS data
62576241
there, but, we pulled out its bitmap into op_info, so now we have to
62586242
put that back into the OP_XCLASS. */
62596243

6244+
#ifndef SUPPORT_WIDE_CHARS
6245+
else
6246+
{
6247+
PCRE2_DEBUG_UNREACHABLE();
6248+
}
6249+
#else
62606250
else
62616251
{
62626252
BOOL need_map;
@@ -6269,10 +6259,22 @@ for (;; pptr++)
62696259

62706260
if (lengthptr != NULL)
62716261
{
6262+
/* Don't unconditionally request all the space we need - we may
6263+
already have asked for more during processing of the ECLASS. */
62726264
if (required_len > (*lengthptr - previous_length))
62736265
{
62746266
*lengthptr = previous_length + required_len;
62756267
}
6268+
6269+
/* The code we write out here won't be ignored, even during the
6270+
(lengthptr != NULL) phase, because if there's a following quantifier
6271+
it will peek backwards. So we do have to write out a (truncated)
6272+
OP_XCLASS, even on this branch. */
6273+
*lengthptr -= 1 + LINK_SIZE + 1;
6274+
*code++ = OP_XCLASS;
6275+
PUT(code, 0, 1 + LINK_SIZE + 1);
6276+
code += LINK_SIZE;
6277+
*code++ = 0;
62766278
}
62776279
else
62786280
{
@@ -6307,6 +6309,7 @@ for (;; pptr++)
63076309
code += rest_len;
63086310
}
63096311
}
6312+
#endif /* SUPPORT_WIDE_CHARS */
63106313
}
63116314

63126315
/* Otherwise, we're going to keep the OP_ECLASS. However, again we need

src/pcre2_compile_class.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,7 +2161,7 @@ switch (meta)
21612161
data_start = map_start + 32 / sizeof(PCRE2_UCHAR);
21622162
memcpy(pop_info->bits.classbits, map_start, 32);
21632163
memmove(map_start, data_start, CU2BYTES(code - data_start));
2164-
2164+
21652165
/* Rewind the code pointer, but make sure we adjust *lengthptr, because we
21662166
do need to reserve that space (even though we only use it temporarily). */
21672167
if (lengthptr != NULL)
@@ -2229,7 +2229,7 @@ while (*ptr != META_CLASS_END &&
22292229
uint32_t op;
22302230
BOOL rhs_negated;
22312231
eclass_op_info rhs_op_info;
2232-
2232+
22332233
if (negated)
22342234
{
22352235
/* !(A juxtapose B) -> !A && !B */
@@ -2322,7 +2322,7 @@ while (*ptr == META_ECLASS_AND)
23222322
uint32_t op;
23232323
BOOL rhs_negated;
23242324
eclass_op_info rhs_op_info;
2325-
2325+
23262326
if (negated)
23272327
{
23282328
/* !(A && B) -> !A || !B */
@@ -2399,7 +2399,7 @@ while (*ptr >= META_ECLASS_OR && *ptr <= META_ECLASS_XOR)
23992399
BOOL op_neg;
24002400
BOOL rhs_negated;
24012401
eclass_op_info rhs_op_info;
2402-
2402+
24032403
if (negated)
24042404
{
24052405
/* The whole expression is being negated; we respond by unconditionally

0 commit comments

Comments
 (0)