From: Amos Jeffries Date: Mon, 1 Dec 2008 11:32:52 +0000 (+1300) Subject: Rollback rev 9253 from 3.1 X-Git-Tag: SQUID_3_2_0_1~1311 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=964ae882255d58f53520ab020d708572bffae42f;p=thirdparty%2Fsquid.git Rollback rev 9253 from 3.1 This change to StoreIO overlooked the signedness of the StoreIO* length parameter. It may have resulted in objects that should not have been store making their way into the cache. Caches created by 3.1.0.2 and earlier releases are known to contain many invalid entries. Whether or not these entries are fatal to Squid is still unknown. It is currently expected that they will be erased properly, but cause a lot of cache.log warnings while that is happening. It may be worth purging caches on upgrade out of these versions. --- diff --git a/src/StoreIOBuffer.h b/src/StoreIOBuffer.h index 4ef3c65923..a9fd8a4f6c 100644 --- a/src/StoreIOBuffer.h +++ b/src/StoreIOBuffer.h @@ -46,15 +46,9 @@ public: StoreIOBuffer():length(0), offset (0), data (NULL) {flags.error = 0;} StoreIOBuffer(size_t aLength, int64_t anOffset, char *someData) : - offset (anOffset), data (someData) { - /* maintain own state: detect size errors now */ - if (aLength <0) { - flags.error = 1; - length = 0; - } else { - flags.error = 0; - length = aLength; - } + length (aLength), offset (anOffset), data (someData) + { + flags.error = 0; } /* Create a StoreIOBuffer from a MemBuf and offset */ diff --git a/src/store_client.cc b/src/store_client.cc index 0757cfa35d..137839c865 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -145,8 +145,11 @@ store_client::callback(ssize_t sz, bool error) { StoreIOBuffer result(sz, 0 ,copyInto.data); - if (error) { + if (sz < 0) { result.flags.error = 1; + result.length = 0; + } else { + result.flags.error = error ? 1 : 0; } result.offset = cmp_offset;