Commit 38f73570 authored by Geoff Simmons's avatar Geoff Simmons

Move the assertion that VCL_INT always fits PCRE2_SIZE into the event function.

parent 0ef229c5
......@@ -154,6 +154,15 @@ event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
int ret;
uint32_t where;
/*
* A VCL_INT must never be larger than PCRE2_SIZE_MAX, so
* that some assignments from INT params cannot be out of
* range.
* XXX: C11 static_assert would catch this at compile
* time.
*/
assert(sizeof(VCL_INT) <= sizeof(PCRE2_SIZE));
ret = pcre2_config(PCRE2_CONFIG_JIT, &where);
assert(ret >= 0);
have_jit = where;
......@@ -224,11 +233,6 @@ vmod_regex__init(VRT_CTX, struct vmod_pcre2_regex **regexp,
vcl_name);
return;
}
/*
* assert that a VCL_INT can never be larger than PCRE2_SIZE_MAX,
* to assume that max_pattern_len can never be too large.
*/
assert(sizeof(VCL_INT) <= sizeof(PCRE2_SIZE));
if (max_pattern_length < 0) {
VERR(ctx, "max_pattern_len (%lld) must be >= 0 in %s "
"constructor", (long long)max_pattern_length, vcl_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment