Add some casts and other tidies to pcre2test formatting of size_t values
This commit is contained in:
parent
b52d055d1b
commit
ff5402a378
|
@ -11,6 +11,11 @@ Alpine Linux).
|
||||||
|
|
||||||
2. Merged patch from @carenas (GitHub #110) for pthreads support in CMake.
|
2. Merged patch from @carenas (GitHub #110) for pthreads support in CMake.
|
||||||
|
|
||||||
|
3. SSF scorecards grumbled about possible overflow in an expression in
|
||||||
|
pcre2test. It never would have overflowed in practice, but some casts have been
|
||||||
|
added and at the some time there's been some tidying of fprints that output
|
||||||
|
size_t values.
|
||||||
|
|
||||||
|
|
||||||
Version 10.40 15-April-2022
|
Version 10.40 15-April-2022
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
|
@ -927,7 +927,6 @@ static BOOL jit_was_used;
|
||||||
static BOOL restrict_for_perl_test = FALSE;
|
static BOOL restrict_for_perl_test = FALSE;
|
||||||
static BOOL show_memory = FALSE;
|
static BOOL show_memory = FALSE;
|
||||||
|
|
||||||
static int code_unit_size; /* Bytes */
|
|
||||||
static int jitrc; /* Return from JIT compile */
|
static int jitrc; /* Return from JIT compile */
|
||||||
static int test_mode = DEFAULT_TEST_MODE;
|
static int test_mode = DEFAULT_TEST_MODE;
|
||||||
static int timeit = 0;
|
static int timeit = 0;
|
||||||
|
@ -937,6 +936,7 @@ clock_t total_compile_time = 0;
|
||||||
clock_t total_jit_compile_time = 0;
|
clock_t total_jit_compile_time = 0;
|
||||||
clock_t total_match_time = 0;
|
clock_t total_match_time = 0;
|
||||||
|
|
||||||
|
static uint32_t code_unit_size; /* Bytes */
|
||||||
static uint32_t dfa_matched;
|
static uint32_t dfa_matched;
|
||||||
static uint32_t forbid_utf = 0;
|
static uint32_t forbid_utf = 0;
|
||||||
static uint32_t maxlookbehind;
|
static uint32_t maxlookbehind;
|
||||||
|
@ -4307,12 +4307,18 @@ if (test_mode == PCRE32_MODE) cblock_size = sizeof(pcre2_real_code_32);
|
||||||
(void)pattern_info(PCRE2_INFO_SIZE, &size, FALSE);
|
(void)pattern_info(PCRE2_INFO_SIZE, &size, FALSE);
|
||||||
(void)pattern_info(PCRE2_INFO_NAMECOUNT, &name_count, FALSE);
|
(void)pattern_info(PCRE2_INFO_NAMECOUNT, &name_count, FALSE);
|
||||||
(void)pattern_info(PCRE2_INFO_NAMEENTRYSIZE, &name_entry_size, FALSE);
|
(void)pattern_info(PCRE2_INFO_NAMEENTRYSIZE, &name_entry_size, FALSE);
|
||||||
fprintf(outfile, "Memory allocation (code space): %d\n",
|
|
||||||
(int)(size - name_count*name_entry_size*code_unit_size - cblock_size));
|
/* The uint32_t variables are cast before multiplying to stop code analyzers
|
||||||
|
grumbling about potential overflow. */
|
||||||
|
|
||||||
|
fprintf(outfile, "Memory allocation (code space): %" SIZ_FORM "\n", size -
|
||||||
|
(size_t)name_count * (size_t)name_entry_size * (size_t)code_unit_size -
|
||||||
|
cblock_size);
|
||||||
|
|
||||||
if (pat_patctl.jit != 0)
|
if (pat_patctl.jit != 0)
|
||||||
{
|
{
|
||||||
(void)pattern_info(PCRE2_INFO_JITSIZE, &size, FALSE);
|
(void)pattern_info(PCRE2_INFO_JITSIZE, &size, FALSE);
|
||||||
fprintf(outfile, "Memory allocation (JIT code): %d\n", (int)size);
|
fprintf(outfile, "Memory allocation (JIT code): %" SIZ_FORM "\n", size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4327,7 +4333,7 @@ show_framesize(void)
|
||||||
{
|
{
|
||||||
size_t frame_size;
|
size_t frame_size;
|
||||||
(void)pattern_info(PCRE2_INFO_FRAMESIZE, &frame_size, FALSE);
|
(void)pattern_info(PCRE2_INFO_FRAMESIZE, &frame_size, FALSE);
|
||||||
fprintf(outfile, "Frame size for pcre2_match(): %d\n", (int)frame_size);
|
fprintf(outfile, "Frame size for pcre2_match(): %" SIZ_FORM "\n", frame_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue