Commit 1c11a5fc authored by Geoff Simmons's avatar Geoff Simmons

Bugfix reporting pcre2 error messages when workspace is exhausted.

parent 0e066bfa
...@@ -214,9 +214,20 @@ report_pcre2_err(VRT_CTX, int errcode, const char * const restrict msg, ...@@ -214,9 +214,20 @@ report_pcre2_err(VRT_CTX, int errcode, const char * const restrict msg,
VERR(ctx, "%s (unknown error code)%s", msg, post); VERR(ctx, "%s (unknown error code)%s", msg, post);
} }
else if (ret == PCRE2_ERROR_NOMEMORY) { else if (ret == PCRE2_ERROR_NOMEMORY) {
WS_Release(ctx->ws, strlen(buf) + 1); unsigned len = strlen(buf) + 1;
VERR(ctx, "%s: %s (truncated error message)%s", msg, buf,
post); if (len > bytes) {
WS_Release(ctx->ws, 0);
ERRNOMEM(ctx, "allocating workspace for pcre2 error "
"message");
VERR(ctx, "%s: libpcre2 error code %d%s", msg, errcode,
post);
}
else {
WS_Release(ctx->ws, len);
VERR(ctx, "%s: %s (truncated error message)%s", msg,
buf, post);
}
} }
else { else {
WS_Release(ctx->ws, ret); WS_Release(ctx->ws, ret);
......
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