Commit 7eacc5df authored by Geoff Simmons's avatar Geoff Simmons

check for workspace overflow after calling WS_Reserve()

parent 452fab32
......@@ -248,6 +248,11 @@ sub(VRT_CTX, vre2 * restrict vre2, const int all, VCL_STRING text,
ret = WS_Snapshot(ctx->ws);
bytes = WS_Reserve(ctx->ws, 0);
if (bytes == 0) {
VERR(ctx, ERR_PREFIX "workspace overflow", text, rewrite,
fallback);
return fallback;
}
if ((err = vre2_replace(vre2, all, text, rewrite, ret, bytes, &match,
&len))
!= NULL) {
......@@ -278,6 +283,11 @@ extract(VRT_CTX, vre2 * restrict vre2, VCL_STRING text, VCL_STRING rewrite,
ret = WS_Snapshot(ctx->ws);
bytes = WS_Reserve(ctx->ws, 0);
if (bytes == 0) {
VERR(ctx, ERR_PREFIX "workspace overflow", text, rewrite,
fallback);
return fallback;
}
if ((err = vre2_extract(vre2, text, rewrite, ret, bytes, &match, &len))
!= NULL) {
VERR(ctx, ERR_PREFIX "%s", text, rewrite, fallback, err);
......
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