[Java][#MG6] zlib error after parsing many objects successfully

I’m stuck on the last Stage #MG6 while parsing Pack objects I get an inflation error after successfully parsing dozens or even over a hundred objects.

Failure is consistently in the same spot for a given repo. But otherwise no pattern I can determine - I’ve seen it fail for blob, tree & commit objects. My logic for deltified objects are also enough so I can carry on parsing, albeit incomplete. Typically no errors for extremely simple repos with short history.

Seems like I’m missing a special case. Help!

Exception below along with some logs that show previous objects were successfully parsed. Relevant code is probably around this area.

DEBUG org.howietkl.git.GitPack - processObjects objectIndex=103 type=BLOB size=51
DEBUG org.howietkl.git.GitPack - processObjects objectIndex=104 type=BLOB size=59
DEBUG org.howietkl.git.GitPack - processObjects objectIndex=105 type=BLOB size=32
DEBUG org.howietkl.git.GitPack - processObjects objectIndex=106 type=BLOB size=45
DEBUG org.howietkl.git.GitPack - processObjects objectIndex=107 type=TREE size=268
DEBUG org.howietkl.git.GitPack - processObjects objectIndex=108 type=BLOB size=5
java.util.zip.DataFormatException: incorrect header check
	at java.base/java.util.zip.Inflater.inflateBytesBytes(Native Method)
	at java.base/java.util.zip.Inflater.inflate(Inflater.java:400)
	at java.base/java.util.zip.Inflater.inflate(Inflater.java:470)
	at org.howietkl.git.utils.Utils.getInflated(Utils.java:44)
	at org.howietkl.git.GitPack.processUndeltified(GitPack.java:142)
	at org.howietkl.git.GitPack.processObject(GitPack.java:103)
	at org.howietkl.git.GitPack.processObjects(GitPack.java:91)
	at org.howietkl.git.GitPack.process(GitPack.java:73)
	at org.howietkl.git.command.CloneCommand.gitClone(CloneCommand.java:37)
	at org.howietkl.git.command.CloneCommand.execute(CloneCommand.java:21)
	at Main.main(Main.java:24)

Things I’ve tried:

  • Ruled out varint parsing by testing my lib against that of another challenger.

Hey @HowieTKL, looks like you’ve got past the last stage. Congratulations! :party_popper:

Would you mind sharing what was wrong? Would love to see if we can improve the tester / instructions.

It’s still a problem! I just added code to ignore the failure, and try to reconstitute the repo with reduced information… just happens to be enough to pass the test. If anyone has any ideas, I still want to fix it.

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.