Validate the DIRC footer during read
commit88a1acb00db8f216a48a4f7d878044e3d9bbae4d
authorShawn O. Pearce <spearce@spearce.org>
Thu, 9 Apr 2009 15:28:19 +0000 (9 08:28 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 10 Apr 2009 02:33:10 +0000 (10 04:33 +0200)
treef503eb95d4554390d4a3d5743fc9b06ec8cd2ac7
parent1fcb96952f5ca6c2d9338b1119a44a8d575dfaeb
Validate the DIRC footer during read

To ensure we didn't read a partial file, or a file that has a corrupt
content (e.g. due power failure on a buggy unjournaled filesystem)
we now validate the entire content of the DIRC file through its final
SHA1 checksum at the end of the stream.

This slightly slows down the read path, as we now have to process a
lot of small buffers (info and path objects) through the digest, but
we're better off ensuring the content is reasonably sane.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/dircache/DirCache.java
org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheEntry.java