diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-12-22 14:11:18 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-12-22 14:11:22 -0800 |
commit | 6533994bc97609630fd2f20f4dd457a8f19901d1 (patch) | |
tree | f364807a0c6c76c886e41cc95171ee4669ce365c /org.eclipse.jgit.test/tst-rsrc | |
parent | edeea800a6b482cc721ac11b8d767ca0392947f8 (diff) | |
download | jgit-6533994bc97609630fd2f20f4dd457a8f19901d1.tar.gz jgit-6533994bc97609630fd2f20f4dd457a8f19901d1.zip |
Fix ArrayIndexOutOfBoundsException in DirCacheIterator
If the 'TREE' extension contains an invalid subtree that has
been removed, DirCacheIterator still tried to access it due to
an invalid childCnt field within the parent DirCacheTree object.
This is easy for a user to do, they just need to move all files
out of a subdirectory.
For example, the input for the JUnit test case for this bug was
built using the following C Git sequence:
mkdir -p a/b
touch a/b/c q
git add a/b/c q
git write-tree
git mv a/b/c a/a
After the last step, the subdirectory a/b is empty, as its only
file was moved into the parent directory. Because of the earlier
`git write-tree` operation, there is a 'TREE' extension present, but
the a and a/b subdirectories have been marked invalid by the rename.
When JGit tried to iterate over the a tree, it tried to correct
childCnt to be zero as a/b no longer exists, but it failed to
update childCnt.
Change-Id: I7a0f78fc48a36b1a83252d354618f6807fca0426
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst-rsrc')
-rw-r--r-- | org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/dircache.testRemovedSubtree | bin | 0 -> 196 bytes |
1 files changed, 0 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/dircache.testRemovedSubtree b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/dircache.testRemovedSubtree Binary files differnew file mode 100644 index 0000000000..01aa24d110 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/dircache.testRemovedSubtree |