]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Rollback rev 8909
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2008 05:30:29 +0000 (18:30 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2008 05:30:29 +0000 (18:30 +1300)
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
src/store_client.cc

index 70d4e41a78e17b20b8062ea632ac4cb753ab13fa..0d55cd28ccb5cad49a2fe4791691a28b630e3ae2 100644 (file)
@@ -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 */
index a8090076dc03d1579f9818b644e63e5047ca329b..50955b0a354b7b590ef4b49161878b2894212598 100644 (file)
@@ -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;