From: William Lima Date: Thu, 18 Feb 2016 12:48:08 +0000 (+1300) Subject: Bug 3870: assertion failed: String.cc: 'len_ + len <65536' in ESI::CustomParser X-Git-Tag: SQUID_4_0_7~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=89f7bca852b05a2e529a14da6c8d8cb3d2c8a511;p=thirdparty%2Fsquid.git Bug 3870: assertion failed: String.cc: 'len_ + len <65536' in ESI::CustomParser The custom ESI parser used in absence of libxml2 or libexpat parsers was restricted to handling 64KB buffers but under some conditions could expand to over 64KB during the parse process. Hitting this assertion. TODO: the parser can now be redesigned to make use of Tokenizer and CharacterSet parsing tools. But that is left for later work. --- diff --git a/src/esi/CustomParser.cc b/src/esi/CustomParser.cc index 84a5cd9af5..9bfe03bb29 100644 --- a/src/esi/CustomParser.cc +++ b/src/esi/CustomParser.cc @@ -89,9 +89,11 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool } size_t openESITags (0); - //erring on the safe side. Probably rawBuf would be ok too - char const *currentPos = content.termedBuf(); - size_t remainingCount = content.size(); + // TODO: convert to Tokenizer parse + // erring on the safe side for now. Probably rawContent would be ok too + // note that operations below do *X='\0' ... altering the 'const' buffer content. + char const *currentPos = content.c_str(); + SBuf::size_type remainingCount = content.length(); char const *tag = NULL; while ((tag = findTag(currentPos, remainingCount))) { diff --git a/src/esi/CustomParser.h b/src/esi/CustomParser.h index 7a060b4e0d..565fbaa790 100644 --- a/src/esi/CustomParser.h +++ b/src/esi/CustomParser.h @@ -14,7 +14,7 @@ class Trie; /* inherits from */ #include "esi/Parser.h" -/* for String variables */ +#include "SBuf.h" #include "SquidString.h" /** @@ -46,7 +46,7 @@ private: ESIParserClient *theClient; String error; /* cheap n dirty - buffer it all */ - String content; + SBuf content; /* TODO: make a class of this type code */ ESITAG_t lastTag; };