[master] 98dc17709 Only fail on workspace exhaustion if we actually need it.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Sep 9 14:15:06 UTC 2019
commit 98dc17709df79b91b964c79472af3b09779f481f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Sep 9 14:13:25 2019 +0000
Only fail on workspace exhaustion if we actually need it.
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index d943fe205..e25866be1 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -513,20 +513,24 @@ VRT_UpperLowerStrands(VRT_CTX, VCL_STRANDS s, int up)
(!up && vct_isupper(*p))) {
*b++ = *p ^ 0x20;
copy = 1;
- } else {
+ } else if (b < e) {
*b++ = *p;
}
- if (b == e) {
- WS_Release(ctx->ws, 0);
- VRT_fail(ctx, "Workspace overflow");
- return (NULL);
- }
+ if (copy && b == e)
+ break;
+ }
+ if (copy && b == e) {
+ WS_Release(ctx->ws, 0);
+ VRT_fail(ctx, "Workspace overflow");
+ return (NULL);
}
}
+ assert(b <= e);
if (!copy) {
WS_Release(ctx->ws, 0);
return (q);
}
+ assert(b < e);
*b++ = '\0';
assert(b <= e);
WS_ReleaseP(ctx->ws, b);
More information about the varnish-commit
mailing list