]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ESI: throw on large stack recursions (#408)
authorAmos Jeffries <yadij@users.noreply.github.com>
Mon, 20 May 2019 11:23:13 +0000 (11:23 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 21 May 2019 03:25:38 +0000 (03:25 +0000)
This reduces the impact on concurrent clients to only those
accessing the malformed resource.

Depending on what type of recursion is being performed the
resource may appear to the client with missing segments, or
not at all.

src/esi/Esi.cc

index c7c6a786225e3e006f7fb9c000b90f71b1b5f50a..c1f5a0eef04dc04756436054b9def6cf9a7ff323 100644 (file)
@@ -930,7 +930,7 @@ void
 ESIContext::addStackElement (ESIElement::Pointer element)
 {
     /* Put on the stack to allow skipping of 'invalid' markup */
-    assert (parserState.stackdepth <11);
+    Must(parserState.stackdepth < 10);
     assert (!failed());
     debugs(86, 5, "ESIContext::addStackElement: About to add ESI Node " << element.getRaw());
 
@@ -1188,7 +1188,7 @@ ESIContext::addLiteral (const char *s, int len)
     assert (len);
     debugs(86, 5, "literal length is " << len);
     /* give a literal to the current element */
-    assert (parserState.stackdepth <11);
+    Must(parserState.stackdepth < 10);
     ESIElement::Pointer element (new esiLiteral (this, s, len));
 
     if (!parserState.top()->addElement(element)) {