From a582d787b89ba2f5bf9d5812254da1a5beae9999 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 1 Dec 2008 18:30:29 +1300 Subject: [PATCH] Rollback rev 8909 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.0.STABLE10 release are known to contain many invalid entries when rolled back to STABLE9 release. 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 is left to admin to decide if its worth purging their cache on upgrade. --- src/StoreIOBuffer.h | 12 ++---------- src/store_client.cc | 5 ++++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/StoreIOBuffer.h b/src/StoreIOBuffer.h index 70d4e41a78..0d55cd28cc 100644 --- a/src/StoreIOBuffer.h +++ b/src/StoreIOBuffer.h @@ -46,17 +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) + length (aLength), 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; - } + flags.error = 0; } /* Create a StoreIOBuffer from a MemBuf and offset */ diff --git a/src/store_client.cc b/src/store_client.cc index a8090076dc..50955b0a35 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; -- 2.47.2