------------------------------------------------------------ revno: 13855 revision-id: squid3@treenet.co.nz-20150701044000-9peba7u7t1pg3cog parent: squid3@treenet.co.nz-20150628101358-ra31xc9h12n1q48e fixes bug: http://bugs.squid-cache.org/show_bug.cgi?id=3483 author: Chudy Fernandez , Amos Jeffries committer: Amos Jeffries branch nick: 3.5 timestamp: Tue 2015-06-30 21:40:00 -0700 message: Bug 3483: assertion failed store.cc:1866: 'isEmpty()' ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20150701044000-9peba7u7t1pg3cog # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 0b5da2c10ce60d5390d721135f770a27dd3e0130 # timestamp: 2015-07-01 04:50:54 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20150628101358-\ # ra31xc9h12n1q48e # # Begin patch === modified file 'src/StoreClient.h' --- src/StoreClient.h 2015-01-13 09:13:49 +0000 +++ src/StoreClient.h 2015-07-01 04:40:00 +0000 @@ -80,7 +80,7 @@ void scheduleMemRead(); void scheduleRead(); bool startSwapin(); - void unpackHeader(char const *buf, ssize_t len); + bool unpackHeader(char const *buf, ssize_t len); int type; bool object_ok; === modified file 'src/store_client.cc' --- src/store_client.cc 2015-01-13 09:13:49 +0000 +++ src/store_client.cc 2015-07-01 04:40:00 +0000 @@ -526,15 +526,14 @@ sc->readBody(buf, len); } -void +bool store_client::unpackHeader(char const *buf, ssize_t len) { debugs(90, 3, "store_client::unpackHeader: len " << len << ""); if (len < 0) { - debugs(90, 3, "store_client::unpackHeader: " << xstrerror() << ""); - fail(); - return; + debugs(90, 3, "WARNING: unpack error: " << xstrerror()); + return false; } int swap_hdr_sz = 0; @@ -543,16 +542,14 @@ if (!aBuilder.isBufferSane()) { /* oops, bad disk file? */ debugs(90, DBG_IMPORTANT, "WARNING: swapfile header inconsistent with available data"); - fail(); - return; + return false; } tlv *tlv_list = aBuilder.createStoreMeta (); if (tlv_list == NULL) { debugs(90, DBG_IMPORTANT, "WARNING: failed to unpack meta data"); - fail(); - return; + return false; } /* @@ -561,8 +558,7 @@ for (tlv *t = tlv_list; t; t = t->next) { if (!t->checkConsistency(entry)) { storeSwapTLVFree(tlv_list); - fail(); - return; + return false; } } @@ -577,6 +573,7 @@ debugs(90, 5, "store_client::unpackHeader: swap_file_sz=" << entry->swap_file_sz << "( " << swap_hdr_sz << " + " << entry->mem_obj->object_sz << ")"); + return true; } void @@ -588,11 +585,15 @@ flags.disk_io_pending = false; assert(_callback.pending()); - unpackHeader (buf, len); - + // abort if we fail()'d earlier if (!object_ok) return; + if (!unpackHeader(buf, len)) { + fail(); + return; + } + /* * If our last read got some data the client wants, then give * it to them, otherwise schedule another read.