]> source.dussan.org Git - jgit.git/commit
Fix loading packed objects >2G 90/5490/2
authorShawn O. Pearce <spearce@spearce.org>
Wed, 28 Mar 2012 14:12:20 +0000 (10:12 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 28 Mar 2012 14:36:51 +0000 (10:36 -0400)
commit6c0d300a54f14fcfbd05dab5756097986b20eca8
tree0aa120fda99a07d54ed50285f75ee1fc016d8657
parent55bf06b43d8e8ed2f15357e4ecf26eefbff31e29
Fix loading packed objects >2G

Parsing the size from a packed object header was incorrectly computing
the total inflated length when the length exceeded the range of a Java
int. The next 7 bits of size information was shifted left as an int
using a shift of 25 bits, placing the higher bits of the size into the
sign position. When this size was extended to a long to be added to
the current size accumulator the size went negative, resulting in
NegativeArraySizeException being thrown.

Fix all places where this particular pattern of code is used to read a
pack size field, or a binary delta header, as they both use the same
variable length encoding scheme.

Change-Id: I04008728ed828f18202652c3d5401cf95a441d0a
org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/PackChunk.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/BinaryDelta.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java