Skip to content

Commit

Permalink
fixup! Improve character range matching with binary search
Browse files Browse the repository at this point in the history
  • Loading branch information
carenas committed Oct 17, 2024
1 parent 3e795ba commit 30442c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

canary:
name: gcc
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -20,10 +20,10 @@ jobs:
run: ./autogen.sh

- name: Configure
run: ./configure CC='gcc -O0 -fsanitize=undefined,address -fsanitize-undefined-trap-on-error' CPPFLAGS='-Wall -Wextra -Werror -Wno-error=unused-but-set-parameter' --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug --with-link-size=4
run: ./configure CC='gcc -fsanitize=undefined,address -fsanitize-undefined-trap-on-error' --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug --with-link-size=4

- name: Build
run: make -j3
run: make CPPFLAGS='-pedantic -Wall -Wextra -Wpedantic -Wdeclaration-after-statement -Wshadow -Wno-overlength-strings -Werror' -j3

- name: Test (main test script)
run: ./RunTest
Expand Down
6 changes: 3 additions & 3 deletions src/pcre2_jit_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7722,7 +7722,7 @@ static void xclass_compute_ranges(compiler_common *common, PCRE2_SPTR cc, xclass
{
DEFINE_COMPILER;
size_t range_count = 0, est_range_count;
size_t total_size, est_stack_size, tmp;
size_t total_stack_size, est_stack_size, tmp;
uint32_t type, list_ind;
uint32_t est_type;
uint32_t char_list_add, range_start, range_end;
Expand Down Expand Up @@ -7813,10 +7813,10 @@ if (est_range_count > XCLASS_LOCAL_RANGES_SIZE)
tmp >>= 1;
}

total_size = (sizeof(xclass_stack_item) * est_stack_size) +
total_stack_size = (sizeof(xclass_stack_item) * est_stack_size) +
((sizeof(uint32_t) << 1) * (size_t)est_range_count);

ranges->stack = (xclass_stack_item*)SLJIT_MALLOC(total_size, compiler->allocator_data);
ranges->stack = (xclass_stack_item*)SLJIT_MALLOC(total_stack_size, compiler->allocator_data);

if (ranges->stack == NULL)
{
Expand Down
4 changes: 2 additions & 2 deletions src/pcre2_study.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ study_char_list(PCRE2_SPTR code, uint8_t *start_bitmap)
uint32_t type, list_ind;
uint32_t char_list_add = XCL_CHAR_LIST_LOW_16_ADD;
uint32_t range_start = ~(uint32_t)0, range_end = 0;
uint8_t *next_char;
PCRE2_SPTR next_char;
PCRE2_UCHAR start_buffer[6], end_buffer[6];
PCRE2_UCHAR start, end;

Expand All @@ -951,7 +951,7 @@ type = (uint32_t)(code[0] << 8) | code[1];
code += 2;

/* Align characters. */
next_char = (uint8_t*)code;
next_char = code;
next_char += (type >> XCL_ALIGNMENT_SHIFT) & XCL_ALIGNMENT_MASK;
type &= XCL_TYPE_MASK;
list_ind = 0;
Expand Down

0 comments on commit 30442c4

Please sign in to comment.