Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] NegativeArraySizeException in PackIndexV2


----- Ursprungligt meddelande -----
> Från: "Marc Strapetz" <marc.strapetz@xxxxxxxxxxx>
> Till: "Robin Rosenberg" <robin.rosenberg.lists@xxxxxxxxxx>
> Kopia: jgit-dev@xxxxxxxxxxx
> Skickat: tisdag, 12 aug 2014 13:24:19
> Ämne: Re: [jgit-dev] NegativeArraySizeException in PackIndexV2
> 
> > Is this a ridiculously large pack?
> 
> Unfortunately I don't have any more information than the pure
> stacktrace. How large would be too large? Could the fanoutTable be
> corrupted, so bucketCount < 0?

More than 107 million objects. That would cause this behavior. That would
imply a idx file of nearly 4 GB (36 bytes per object). See https://www.kernel.org/pub/software/scm/git/docs/technical/pack-format.txt

By contrast, the linux kernel repo idx file contains only 2.6 M objects and occupies ~73 MB on disk.

Corruption is a possibility. C Git would probably choke on the file if it was corrupted. 
The index file can be regenerated from the pack using git index-pack. 

-- robin

> -Marc
> 
> On 12.08.2014 11:28, Robin Rosenberg wrote:
> > 
> > 
> > ----- Ursprungligt meddelande -----
> >> Från: "Marc Strapetz" <marc.strapetz@xxxxxxxxxxx>
> >> Till: jgit-dev@xxxxxxxxxxx
> >> Skickat: tisdag, 12 aug 2014 10:50:22
> >> Ämne: [jgit-dev] NegativeArraySizeException in PackIndexV2
> >>
> >> Any ideas regarding this error? Our jgit is based on 3.3.x.
> >>
> >> java.lang.NegativeArraySizeException
> >> 	at
> >> org.eclipse.jgit.internal.storage.file.PackIndexV2.<init>(PackIndexV2.java:123)
> >> 	at
> >> org.eclipse.jgit.internal.storage.file.PackIndex.read(PackIndex.java:137)
> >> 	at
> >> 	org.eclipse.jgit.internal.storage.file.PackIndex.open(PackIndex.java:96)
> >>
> > 
> > Is this a ridiculously large pack?
> > 
> > -- robin
> > 
> >>
> >> The offending code is:
> >>
> >> final long nameLen = bucketCnt * Constants.OBJECT_ID_LENGTH;
> >> if (nameLen > Integer.MAX_VALUE)
> >>   throw new IOException(JGitText.get().indexFileIsTooLargeForJgit);
> >>
> >> final int intNameLen = (int) nameLen;
> >>>>> final byte[] raw = new byte[intNameLen];
> >>
> >> -Marc
> >> _______________________________________________
> >> jgit-dev mailing list
> >> jgit-dev@xxxxxxxxxxx
> >> To change your delivery options, retrieve your password, or unsubscribe
> >> from
> >> this list, visit
> >> https://dev.eclipse.org/mailman/listinfo/jgit-dev
> >>
> > 
> 


Back to the top