Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] jgit and huge files

On Wed, Mar 28, 2012 at 05:30, Marc Strapetz <marc.strapetz@xxxxxxxxxxx> wrote:
> PackFile.load
> curs = org.eclipse.jgit.storage.file.WindowCursor@2c81eb32
> pos = 2418223760
> c = 68
> typeCode = 3
> sz = -2007016313
> shift = 32
> p = 5
> java.lang.RuntimeException:
> position=2418223765;sz=-2007016313;curs.getStreamFileThreshold()=10485760
>     at org.eclipse.jgit.storage.file.PackFile.decompress(PackFile.java:323)
>     at org.eclipse.jgit.storage.file.PackFile.load(PackFile.java:729)
>     at org.eclipse.jgit.storage.file.PackFile.get(PackFile.java:237)

I think I understand the problem, in this expression:

					sz += (c & 0x7f) << shift;

c and shift are both int. As the size gets large, that overflows the
32 bit int before being promoted to a long for the addition to sz. I
think this needs to be rewritten as:

  					sz += ((long) (c & 0x7f)) << shift;

I will post a change to the review server soon with a proper patch.


Back to the top