Warn about files too big that they may cause failures.

This commit is contained in:
Scott Crosby 2010-10-07 11:51:31 -05:00
parent 6d760534c4
commit 5f48470e21
1 changed files with 6 additions and 0 deletions

View File

@ -30,9 +30,15 @@ public class FileBlock extends FileBlockBase {
ByteString indexdata) {
if (blob != null && blob.size() > MAX_BODY_SIZE/2) {
System.err.println("Warning: Fileblock has body size too large and may be considered corrupt");
if (blob != null && blob.size() > MAX_BODY_SIZE-1024*1024) {
throw new Error("This file has too many entities in a block. Parsers will reject it.");
}
}
if (indexdata != null && indexdata.size() > MAX_HEADER_SIZE/2) {
System.err.println("Warning: Fileblock has indexdata too large and may be considered corrupt");
if (indexdata != null && indexdata.size() > MAX_HEADER_SIZE-512) {
throw new Error("This file header is too large. Parsers will reject it.");
}
}
return new FileBlock(type, blob, indexdata);
}