Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] AIOOBE in DirCacheTree.namecmp

On 01.03.2017 21:08, Matthias Sohn wrote:
On Wed, Mar 1, 2017 at 6:45 PM, Marc Strapetz <marc.strapetz@xxxxxxxxxxx
<mailto:marc.strapetz@xxxxxxxxxxx>> wrote:

    I've received a .git/index for which an
    ArrayIndexOutOfBoundsException is raised in
    org.eclipse.jgit.dircache.DirCacheTree#namecmp, line 553:

      if (bPos == bLen)
        return a[aPos] == '/' ? 0 : -1;

    Debug values look like:

    new String(a) = "foo/bar/Headers"
    ct.toString() = "Headers"
    aPos = 14 // aPos == a.length

    So from my understanding, the .git/index contains a tree and a file
    which have the same path.

    Any suggestions on how to fix this (i.e. should it return 0 or 1 in
    this case)?

    -Marc


What's the debug value of ct.getPathString() ?

ct.getPathString() = "foo/bar/Headers/"

As I've been told now, this happened on OS X, "Headers" was initially a directory and immediately before the crash became an alias file.

Can you provide the stack trace of the AIOOBE ?

Please note that I have simplified the path because it seems to contain some confidential information. The real path consists of 8 segments for which I have replaced the first 7 segments by "foo/bar" and only kept the final segment "Headers" as is:

java.lang.ArrayIndexOutOfBoundsException: 103
	at org.eclipse.jgit.dircache.DirCacheTree.namecmp(DirCacheTree.java:557)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:462)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:490)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:490)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:490)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:490)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:490)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:490)
	at org.eclipse.jgit.dircache.DirCacheTree.validate(DirCacheTree.java:490)
	at org.eclipse.jgit.dircache.DirCache.getCacheTree(DirCache.java:942)
at org.eclipse.jgit.dircache.DirCacheIterator.<init>(DirCacheIterator.java:118)

-Marc


Back to the top