------------------------------------------------------------ revno: 12436 revision-id: squid3@treenet.co.nz-20130102034455-tot50otj3kbi4oxt parent: squid3@treenet.co.nz-20130102033431-hg65sqdl80pmfnnn author: Thomas Hozza committer: Amos Jeffries branch nick: 3.3 timestamp: Tue 2013-01-01 20:44:55 -0700 message: Import fixes for some defects found by Coverity Scan from Red Hat's patchset ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20130102034455-tot50otj3kbi4oxt # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: ab500eed1834ec38074fe5766191307c09a70d54 # timestamp: 2013-01-02 03:45:51 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20130102033431-\ # hg65sqdl80pmfnnn # # Begin patch === modified file 'src/HttpHdrRange.cc' --- src/HttpHdrRange.cc 2012-09-22 20:07:31 +0000 +++ src/HttpHdrRange.cc 2013-01-02 03:44:55 +0000 @@ -96,7 +96,7 @@ return false; } else /* must have a '-' somewhere in _this_ field */ - if (!((p = strchr(field, '-')) || (p - field >= flen))) { + if (!((p = strchr(field, '-')) && (p - field < flen))) { debugs(64, 2, "invalid (missing '-') range-spec near: '" << field << "'"); return false; } else { === modified file 'src/MemObject.cc' --- src/MemObject.cc 2012-09-04 09:10:20 +0000 +++ src/MemObject.cc 2013-01-02 03:44:55 +0000 @@ -182,7 +182,7 @@ debugs(20, DBG_IMPORTANT, "MemObject->nclients: " << nclients); debugs(20, DBG_IMPORTANT, "MemObject->reply: " << _reply); debugs(20, DBG_IMPORTANT, "MemObject->request: " << request); - debugs(20, DBG_IMPORTANT, "MemObject->log_url: " << log_url << " " << checkNullString(log_url)); + debugs(20, DBG_IMPORTANT, "MemObject->log_url: " << checkNullString(log_url)); } HttpReply const * === modified file 'src/client_side.cc' --- src/client_side.cc 2012-10-05 07:26:35 +0000 +++ src/client_side.cc 2013-01-02 03:44:55 +0000 @@ -702,7 +702,8 @@ if (request) al->adapted_request = HTTPMSGLOCK(request); accessLogLog(al, checklist); - updateCounters(); + if (request) + updateCounters(); if (getConn() != NULL && getConn()->clientConnection != NULL) clientdbUpdate(getConn()->clientConnection->remote, logType, AnyP::PROTO_HTTP, out.size); === modified file 'src/client_side_reply.cc' --- src/client_side_reply.cc 2012-11-18 11:32:33 +0000 +++ src/client_side_reply.cc 2013-01-02 03:44:55 +0000 @@ -2067,10 +2067,14 @@ ConnStateData * conn = http->getConn(); - if (conn == NULL || !conn->isOpen()) { - // too late, our conn is closing - // TODO: should we also quit? - debugs(33,3, HERE << "not sending more data to a closing " << conn->clientConnection); + // too late, our conn is closing + // TODO: should we also quit? + if (conn == NULL) { + debugs(33,3, "not sending more data to a closed connection" ); + return; + } + if (!conn->isOpen()) { + debugs(33,3, "not sending more data to closing connection " << conn->clientConnection); return; } === modified file 'src/client_side_request.cc' --- src/client_side_request.cc 2012-10-17 02:59:09 +0000 +++ src/client_side_request.cc 2013-01-02 03:44:55 +0000 @@ -1757,6 +1757,7 @@ clientStreamNode *node = (clientStreamNode *)client_stream.tail->prev->data; clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); + assert(repContext); repContext->createStoreEntry(request->method, request->flags); EBIT_CLR(storeEntry()->flags, ENTRY_FWD_HDR_WAIT); === modified file 'src/esi/Esi.cc' --- src/esi/Esi.cc 2012-11-24 03:56:37 +0000 +++ src/esi/Esi.cc 2013-01-02 03:44:55 +0000 @@ -2077,12 +2077,13 @@ debugs (86,3, "esiChooseAdd: Added a new element, elements = " << elements.size()); - if (chosenelement == -1) - if ((dynamic_cast(element.getRaw()))-> - testsTrue()) { + if (chosenelement == -1) { + const esiWhen * topElement=dynamic_cast(element.getRaw()); + if (topElement && topElement->testsTrue()) { chosenelement = elements.size() - 1; debugs (86,3, "esiChooseAdd: Chose element " << elements.size()); } + } } return true; === modified file 'src/fs/ufs/UFSSwapDir.cc' --- src/fs/ufs/UFSSwapDir.cc 2012-12-02 07:26:27 +0000 +++ src/fs/ufs/UFSSwapDir.cc 2013-01-02 03:44:55 +0000 @@ -236,7 +236,7 @@ /* TODO: factor out these 4 lines */ ConfigOption *ioOptions = IO->io->getOptionTree(); - if (ioOptions) + if (currentIOOptions && ioOptions) currentIOOptions->options.push_back(ioOptions); }