[Zlib-devel] Fwd: Buffer alignment problem on the Intel compiler
Mark Adler
madler at alumni.caltech.edu
Sat Mar 24 20:15:59 EDT 2007
zlibbers,
Can someone with Windows take a look at this? I didn't see anything
obviously wrong with his program.
Mark
Begin forwarded message:
> From: Bryan Tower <bryan.tower at intelligentdiscovery.com>
> Date: March 2, 2007 5:48:18 PM PST
> To: Mark Adler <madler at alumni.caltech.edu>
> Cc: jloup at zlib.org
> Subject: Re: Buffer alignment problem on the Intel compiler
>
> Hi Mark,
>
> Thanks for the prompt reply. I am sorry that I missed the
> attachment on
> that last email. It is attached this time.
>
> On Fri, 2007-03-02 at 15:50 -0800, Mark Adler wrote:
>> Bryan,
>>
>> Thank you for your report.
>>
>> On Mar 2, 2007, at 11:59 AM, Bryan Tower wrote:
>>> I have looked through
>>> the documentation and I not found anyone who has noticed the problem
>>> demonstrated in the attached code.
>>
>> There was no attached code.
>>
>>> This cause inflate to
>>> return the incorrect result into the output buffer with certain
>>> inputs.
>>
>> How exactly is the problem manifested? What sort of inputs? What is
>> incorrect about the output? What version of zlib?
>>
>
> The error occurred both is zlib 1.2.1 (that I had compiled myself) and
> with the 1.2.3 dll that I downloaded directly from the
> http://www.zlib.net/ website. It only occurs on Windows. I have not
> been able to reproduce the erroneous behavior on Linux with g++.
>
> I could not classify the problematic inputs exactly. I never saw the
> problem manifest itself while I was inflating compressed ascii text
> files. It only manifested itself when I was inflating compressed
> binary
> files. I can send you a specific file if you would like. I
> compressed
> the binary file using gzip. When I try to inflate it with a gz_reader
> class where the input buffer used by the z_stream is offset from a
> word
> boundary I get the problem. Zlib reports that there is a problem when
> it gets to the CRC at the end of the file. The problem is completely
> reproducible with a constant buffer size, but there are some buffer
> sizes that will not exhibit the problem very often.
> struct foo {
> char space;
> char buff[17];
> };
> This buffer size causes more problems than multiples of 2, but I have
> seen it with a buffer size of 512 as well. A buffer size of 1 always
> works correctly. I don't really need to vary the buffer size, but
> I was
> just trying to find the problem.
>
> The precise problem is that one byte that should be uncompressed to a
> specific value is uncompressed to the wrong value. For example in one
> case a byte should be uncompressed to 0x04 but it is uncompressed to
> 0x00. This happens in more than one inflate call so there could be a
> handful of incorrectly inflated bytes by the time I get to the end of
> the file. The size of the buffer is updated properly and when it
> gets to
> the end of the file the CRC that is being calculated does not match
> the
> CRC that it extracts from the trailer of the compressed file. That is
> understood, because the decompressed bytes are not the same.
>
> I tried this with the visual studio compiler after I sent that last
> email and it exhibits the same behavior as the Intel compiler for
> Windows.
>
> Thanks for you time. If I can clarify anything please let me know. I
> am willing to give you sample files or do more diagnostics if you want
> me to.
>
> Bryan
>
> --
> Bryan Tower • Senior Software Engineer • ATS, Inc.
> web: www.intelligentdiscovery.com
> email: bryan.tower at intelligentdiscovery.com
> (p) 360.698.7100x251 • (f) 360.698.7200
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zlib-alignment-buffer-error.cpp
Type: text/x-c++src
Size: 2311 bytes
Desc: not available
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20070324/2151b4d5/attachment.bin>
-------------- next part --------------
More information about the Zlib-devel
mailing list