# Do not use zlib 1.1.3 with git packs!

4 messages from 2006-04-29 to 2006-04-29. Participants: Johannes Schindelin, Nicolas Pitre, Junio C Hamano.
Thread: https://gitlist.dev/t/3992

## Johannes Schindelin, 2006-04-29 00:52

Subject: Do not use zlib 1.1.3 with git packs!
Message-ID: <Pine.LNX.4.63.0604290245510.30565@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0604290245510.30565%40wbgn013.biozentrum.uni-wuerzburg.de

```
Hi,

I had a strange effect when trying to repack a git repository on my iBook: 
first, "git-repack -a -d" would quit without an error message when about 
57% of the objects were written (*not* when deltifying them!).

It became even stranger when I tracked it to a segmentation fault in 
adler32(), where the debugger insisted that a buffer was NULL, but the 
calling code insisted it was not.

Upgrading to zlib 1.2.3 helped. That is, after I had a complete systen 
fsck-up, since virtually every binary, including su, login and getty, are 
linked to zlib on Mac OS X. (Yeah, yeah, no Linux, I know.)

Ciao,
Dscho

P.S.: This _might_ be related to the git-repack issue that came up a few 
days ago.

```

## Johannes Schindelin, 2006-04-29 01:47

Subject: Re: Do not use zlib 1.1.3 with git packs!
Message-ID: <Pine.LNX.4.63.0604290341380.22696@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0604290341380.22696%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <Pine.LNX.4.63.0604290245510.30565@wbgn013.biozentrum.uni-wuerzburg.de>

```
Hi,

On Sat, 29 Apr 2006, Johannes Schindelin wrote:

> Upgrading to zlib 1.2.3 helped.

Apparently I was too enthusiastic to have a working system again.

The problem showed again, but with a different repository.

This time, though, I have an idea what could be the culprit.

In create_delta(), there might be illegal accesses. The function adler32() 
is called for BLK_SIZE bytes (which is 16 bytes at the moment), starting 
from data, which is initially trg_buf, and is incremented until it is 
(trg_buf + trg_size).

I gather that close to the end, adler32() tries to read 15 bytes after the 
end of the allocated target buffer.

Am I wrong?

Ciao,
Dscho

```

## Nicolas Pitre, 2006-04-29 03:20

Subject: Re: Do not use zlib 1.1.3 with git packs!
Message-ID: <Pine.LNX.4.64.0604282316520.18816@localhost.localdomain>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0604282316520.18816%40localhost.localdomain
In-Reply-To: <Pine.LNX.4.63.0604290341380.22696@wbgn013.biozentrum.uni-wuerzburg.de>

```
On Sat, 29 Apr 2006, Johannes Schindelin wrote:

> Hi,
> 
> On Sat, 29 Apr 2006, Johannes Schindelin wrote:
> 
> > Upgrading to zlib 1.2.3 helped.
> 
> Apparently I was too enthusiastic to have a working system again.
> 
> The problem showed again, but with a different repository.
> 
> This time, though, I have an idea what could be the culprit.
> 
> In create_delta(), there might be illegal accesses. The function adler32() 
> is called for BLK_SIZE bytes (which is 16 bytes at the moment), starting 
> from data, which is initially trg_buf, and is incremented until it is 
> (trg_buf + trg_size).
> 
> I gather that close to the end, adler32() tries to read 15 bytes after the 
> end of the allocated target buffer.
> 
> Am I wrong?

You're not.  My bad.

(I'm testing a version where adler32 has been replaced with rabin 
 polynomial so that issue will be gone at the same time.
 A patch should be coming in less than an hour.)


Nicolas

```

## Junio C Hamano, 2006-04-29 06:36

Subject: Re: Do not use zlib 1.1.3 with git packs!
Message-ID: <7vvessanx1.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vvessanx1.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.64.0604282316520.18816@localhost.localdomain>

```
Nicolas Pitre <nico@cam.org> writes:

> On Sat, 29 Apr 2006, Johannes Schindelin wrote:
>
>> I gather that close to the end, adler32() tries to read 15 bytes after the 
>> end of the allocated target buffer.
>> 
>> Am I wrong?
>
> You're not.  My bad.

Thanks both, for catching this while still in "next".

```
