From: rousskov <> Date: Wed, 25 Apr 2007 20:37:55 +0000 (+0000) Subject: Bug #1940: assertion failed: store.cc:850 X-Git-Tag: SQUID_3_0_PRE6~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56df00807132cf76a746b56217a9cf27d60803a5;p=thirdparty%2Fsquid.git Bug #1940: assertion failed: store.cc:850 Avoid calling writeReplyBody when there is no reply body data to write. FtpStateData calls processReplyBody from several places. When called from icapAclCheckDone we may not be expecting a body for this response. If no body is expected, the store entry may not be in a STORE_PENDING state and when we try to append [zero-sized] body data, the store asserts. If no body is expected, we probably should not be calling processReplyBody! Unfortunately, it was not obvious for me what we should call so I left the call there and made it bypass store writing if there is no body content. If you understand the FtpStateData logic, please try to make sure processReplyBody is not called for objects without a body (it is possible that something else should be called instead though). Please note that ICAP sets virginBodyDestination when body is expected. --- diff --git a/src/ftp.cc b/src/ftp.cc index 1bd3bf809a..e73985d5ee 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.416 2007/04/23 17:50:49 wessels Exp $ + * $Id: ftp.cc,v 1.417 2007/04/25 14:37:55 rousskov Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -1366,10 +1366,11 @@ FtpStateData::processReplyBody() if (flags.isdir) { parseListing(); - } else { - writeReplyBody(data.readBuf->content(), data.readBuf->contentSize()); - debugs(9,5,HERE << "consuming " << data.readBuf->contentSize() << " bytes of readBuf"); - data.readBuf->consume(data.readBuf->contentSize()); + } else + if (const int csize = data.readBuf->contentSize()) { + writeReplyBody(data.readBuf->content(), csize); + debugs(9,5,HERE << "consuming " << csize << " bytes of readBuf"); + data.readBuf->consume(csize); } entry->flush();