]> source.dussan.org Git - jgit.git/commit
PackReverseIndex: verify checksums 93/203193/3
authorAnna Papitto <annapapitto@google.com>
Fri, 14 Jul 2023 19:19:27 +0000 (12:19 -0700)
committerAnna Papitto <annapapitto@google.com>
Tue, 18 Jul 2023 22:19:26 +0000 (15:19 -0700)
commit8123dcd6993457622fc5df08c58c776286cc427a
tree45585cb379855d3f41ff0bb78d846c70780774b2
parent000e7caf5e35ac0fb357aa10f13329f03b4dbee0
PackReverseIndex: verify checksums

The new version 1 file-based reverse index has a footer with the
checksum of the corresponding pack file and a checksum of its own
contents. The initial implementation doesn't enforce that the pack
checksum matches the checksum found in the forward index nor that the
self checksum matches the contents of the file just read in.

Offer a method for reverse index users to verify the checksums in a way
appropriate to the version being used. For the pre-existing computed
version, always succeed since it is not based on a file so there is no
possibility of corruption.

Check for corruption of the file itself during parsing the checksum
footer, by comparing the self checksum with the digest of the file
contents read.

Change-Id: I87ff3933cf1afa76663350400b616695e4966cb6
Signed-off-by: Anna Papitto <annapapitto@google.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackReverseIndexComputedTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackReverseIndexV1Test.java
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndexComputed.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndexV1.java