Author: toad
Date: 2007-07-10 12:05:28 +0000 (Tue, 10 Jul 2007)
New Revision: 14014
Modified:
trunk/freenet/src/freenet/client/async/SingleFileInserter.java
Log:
Fix bug: only disallow 2GB+ inserts if they actually fit in a single CHK/SSK.
Modified: trunk/freenet/src/freenet/client/async/SingleFileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileInserter.java
2007-07-10 11:53:44 UTC (rev 14013)
+++ trunk/freenet/src/freenet/client/async/SingleFileInserter.java
2007-07-10 12:05:28 UTC (rev 14014)
@@ -214,7 +214,7 @@
boolean fitsInOneBlockAsIs = bestCodec == null ?
compressedDataSize < blockSize : compressedDataSize < oneBlockCompressedSize;
boolean fitsInOneCHK = bestCodec == null ? compressedDataSize <
CHKBlock.DATA_LENGTH : compressedDataSize < CHKBlock.MAX_COMPRESSED_DATA_LENGTH;
- if(block.getData().size() > Integer.MAX_VALUE)
+ if((fitsInOneBlockAsIs || fitsInOneCHK) &&
block.getData().size() > Integer.MAX_VALUE)
throw new
InsertException(InsertException.INTERNAL_ERROR, "2GB+ should not encode to one
block!", null);
boolean noMetadata = ((block.clientMetadata == null) ||
block.clientMetadata.isTrivial()) && targetFilename == null;