Browse Source

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 <spearce@spearce.org>
stable-0.8
Shawn O. Pearce 15 years ago
parent
commit
dafa8fbff4
  1. 1
      org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java

1
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)

Loading…
Cancel
Save