From dafa8fbff42be3c644061fa6c81d149097bd31fd Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 23 Apr 2010 11:16:25 -0700 Subject: Fix NPE during InflaterCache return after corrupt loose object If a corrupt loose object is read, UnpackedObjectLoader was disposing of the Inflater, and then attempting to return the disposed Inflater to the InflaterCache. Since the disposed Inflater had its native libz resource deallocated and its reference cleared out, the Inflater threw NullPointerException and refused to reset itself before being put back into the cache. Instead of disposing of the Inflater when corruption is found, do nothing, and allow it to be returned to the cache. The instance will get reset, and should be usable by a future caller. Bug: 310291 Change-Id: I44f2247c08b6e04fa62f8399609341b07508c096 Signed-off-by: Shawn O. Pearce --- org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java | 1 - 1 file changed, 1 deletion(-) (limited to 'org.eclipse.jgit') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java index 968dada0cd..005df4b98d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java @@ -120,7 +120,6 @@ public class UnpackedObjectLoader extends ObjectLoader { final CorruptObjectException coe; coe = new CorruptObjectException(id, "bad stream"); coe.initCause(dfe); - inflater.end(); throw coe; } if (avail < 5) -- cgit v1.2.3