[Zlib-devel] zlib 1.2.2.3 available for testing

Andrei Polushin a-polushin at mail.ru
Mon May 30 19:28:02 EDT 2005


>> you seem to be using the non STDC version of gzprintf in gzio.c here, 
>> which tries to simulate va_list, and on Alpha a 64-bit (pointer) to 
>> 32-bit (int) truncation could happen.
> 
> I think Markus figured it out.  The string in gzprintf() is passed as a 
> pointer, but the sprintf() call is trying to pass a bunch of int 
> arguments.  From the compile flags:
> 
>     zlib version 1.2.2.3 = 0x1223, compile flags = 0x30000a9
> 
> the "...a9" (which was a9 for 1.2.2 as well) means that off_t, pointers, 
> and longs are 64 bits, and ints are 32 bits.  Passing a 64-bit pointer 
> as a 32-bit int just won't work.  So without stdarg, there's no way to 
> get gzprintf() to work in that environment.  Apparently however that 
> environment *does* have stdarg, since 1.2.2 used vsprintf().  So we just 
> need to find a way for it to be reliably used.
> 
> mark

trancation could happen, but it didn't happen. The stack trace says:

 >    2 sprintf(0x11fffd640, 0x140002308, 0x40002310, ...)
 >    3 gzprintf(file = 0x140004100, format = 0x140002308 = ", %s!", a1 
= 1073750800, ...) ["gzio.c":652]
 >    4 test_gzio(fname = 0x1400023e8 = "foo.gz", ...) ["example.c":108]

where 0x40002310 is identical to decimal 1073750800.

This number is va_list struct, that makes sense in the context of 
gzprintf stack frame, but not in in sprintf stack frame.

// Andrei




More information about the Zlib-devel mailing list