Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  zlib binary fails to round trip

warezio
Posted: Tue Jan 22, 2008 10:57 pm Reply with quote
User Joined: 05 May 2007 Posts: 107 Location: Yahoo
Interestingly enough, removing either the first or last character from this binary eliminates the problem.

Cheers,

-- p

-------
37> zlib:unzip (zlib:zip (<<"<?xml version=\"1.0\"?><Tags><DistinctTags>27</DistinctTags><DistinctItems>1</DistinctItems><DistinctUsers>48</DistinctUsers><TotalUsages>80</TotalUsages><FirstTagging><Name>battery</Name><EntityId>B000B6MLSC</EntityId><UserId>A2NNNAUZZIIVC6</UserId><Time>2005-11-29 14:36:26</Time></FirstTagging><LastTagging><Name>xbox 360 accessory</Name><EntityId>B000B6MLSC</EntityId><UserId>A3R2YUWPTEGASY</UserId><Time>2008-01-18 17:17:45</Time></LastTagging><Tag><Name>xbox 360</Name><TagType>Items</TagType><DistinctItems>1</DistinctItems><DistinctUsers>24</DistinctUsers><TotalUsages>24</TotalUsages><FirstTagging><EntityId>B000B6MLSC</EntityId><UserId>A3L6JBR3XAO9L5</UserId><Time>2006-08-29 17:32:38</Time></FirstTagging><LastTagging><EntityId>B000B6MLSC</EntityId><UserId>A3R2YUWPTEGASY</UserId><Time>2008-01-18 17:17:25</Time></LastTagging></Tag><Tag><Name>battery pack</Name><TagType>Items</TagType><DistinctItems>1</DistinctItems><DistinctUsers>13</DistinctUser!
s><TotalUsages>13</TotalUsages><FirstTagging><EntityId>B000B6MLSC</EntityId><UserId>A2XQT4U37YFO40</UserId><Time>2005-12-29 20:10:36</Time></FirstTagging><LastTagging><EntityId>B000B6MLSC</EntityId><UserId>A19EPX5X6LRPPB</UserId><Time>2007-12-28 16:38:36</Time></LastTagging></Tag><Tag><Name>xbox 360 accessory</Name><TagType>Items</TagType><DistinctItems>1</DistinctItems><DistinctUsers>9</DistinctUsers><TotalUsages>9</TotalUsages><FirstTagging><EntityId>B000B6MLSC</EntityId><UserId>A37IUBFAP495XQ</UserId><Time>2007-01-21 14:38:12</Time></FirstTagging><LastTagging><EntityId>B000B6MLSC</EntityId><UserId>A3R2YUWPTEGASY</UserId><Time>2008-01-18 17:17:45</Time></LastTagging></Tag><Tag><Name>battery</Name><TagType>Items</TagType><DistinctItems>1</DistinctItems><DistinctUsers>5</DistinctUsers><TotalUsages>5</TotalUsages><FirstTagging><EntityId>B000B6MLSC</EntityId><UserId>A2NNNAUZZIIVC6</UserId><Time>2005-11-29 14:36:26</Time></FirstTagging><LastTagging><EntityId>B000B6MLSC</Entity!
Id><UserId>A3R2CSI4NSJCCV</UserId><Time>2007-08-05 22:22:28</Time></La
stTagging></Tag><Tag><Name>rechargeable battery</Name><TagType>Items</TagType><DistinctItems>1</DistinctItems><DistinctUsers>4</DistinctUsers><TotalUsages>4</TotalUsages><FirstTagging><EntityId>B000B6MLSC</EntityId><UserId>A368EJ0XEL1PRV</UserId><Time>2006-12-05 20:15:58</Time></FirstTagging><LastTagging><EntityId>B000B6MLSC</EntityId><UserId>A3R2YUWPTEGASY</UserId><Time>2008-01-18 17:17:19</Time></LastTagging></Tag></Tags>">>)).

=ERROR REPORT==== 22-Jan-2008::14:53:52 ===
Error in process <0.196.0> with exit value: {data_error,[{zlib,call,3},{zlib,unzip,1},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {data_error,[{zlib,call,3},
{zlib,unzip,1},
{erl_eval,do_apply,5},
{shell,exprs,6},
{shell,eval_loop,3}]} **

38> zlib:module_info ().
[{exports,[{open,0},
{close,1},
{deflateInit,1},
{deflateInit,2},
{deflateInit,6},
{deflateSetDictionary,2},
{deflateReset,1},
{deflateParams,3},
{deflate,2},
{deflate,3},
{deflateEnd,1},
{inflateInit,1},
{inflateInit,2},
{inflateSetDictionary,2},
{inflateSync,1},
{inflateReset,1},
{inflate,2},
{inflateEnd,1},
{setBufSize,2},
{getBufSize,1},
{crc32,1},
{crc32,2},
{crc32,3},
{adler32,2},
{adler32|...},
{...}|...]},
{imports,[]},
{attributes,[{vsn,[235850242155034454638676172994528236350]}]},
{compile,[{options,[{cwd,"/build/buildd/erlang-11.b.2/lib/kernel/src"},
{outdir,"/build/buildd/erlang-11.b.2/lib/kernel/src/../ebin"},
{i,"/build/buildd/erlang-11.b.2/lib/kernel/src/../include"},
debug_info]},
{version,"4.4.2"},
{time,{2007,1,23,12,4,54}},
{source,"/build/buildd/erlang-11.b.2/lib/kernel/src/zlib.erl"}]}]
--------

Optimism is an essential ingredient of innovation. How else can the
individual favor change over security?

-- Robert Noyce
_______________________________________________
erlang-bugs mailing list
erlang-bugs@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-bugs
Post recived from mailinglist
View user's profile Send private message Yahoo Messenger
mdempsky
Posted: Wed Jan 23, 2008 5:15 am Reply with quote
User Joined: 24 Sep 2007 Posts: 118
On 1/22/08, Paul Mineiro <paul-trapexit@mineiro.com> wrote:
> Interestingly enough, removing either the first or last character from this binary eliminates the problem.

I can't reproduce this with either R11B-5 or R12B-0, but I suspect the
word wrapping is at fault. Can you send this binary again, but using
the output from io:write/1?
_______________________________________________
erlang-bugs mailing list
erlang-bugs@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-bugs
Post recived from mailinglist
View user's profile Send private message
warezio
Posted: Wed Jan 23, 2008 6:14 pm Reply with quote
User Joined: 05 May 2007 Posts: 107 Location: Yahoo
Gentlemen,

I can only reproduce this on a feisty box running 11b-2 (my bad, didn't
notice the version difference at first). My mac has 11b-5 and doesn't have
the problem.

However, the problem under 11b-2 is data dependent so it's possible that
it still exists under 11b-5 and we just don't know how to tickle it. Do
you have an 11b-2 setup you can fire up to investigate?

I've attached a file called "mega" with the bad data in it to
disambiguate.

Thanks,

-- p

3> [ zlib:unzip (zlib:zip (Bin)) || { ok, Bin } <- [ file:read_file ("mega") ] ].
=ERROR REPORT==== 23-Jan-2008::10:04:42 ===
Error in process <0.32.0> with exit value: {data_error,[{zlib,call,3},{zlib,unzip,1},{erl_eval,do_apply,5},{erl_eval,eval_lc1,5},{lists,flatmap,2},{erl_eval,eval_lc,6},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {data_error,[{zlib,call,3},
{zlib,unzip,1},
{erl_eval,do_apply,5},
{erl_eval,eval_lc1,5},
{lists,flatmap,2},
{erl_eval,eval_lc,6},
{shell,exprs,6},
{shell,eval_loop,3}]} **
4> [ Compile || { compile, Compile } <- zlib:module_info () ].
[[{options,[{cwd,"/build/buildd/erlang-11.b.2/lib/kernel/src"},
{outdir,"/build/buildd/erlang-11.b.2/lib/kernel/src/../ebin"},
{i,"/build/buildd/erlang-11.b.2/lib/kernel/src/../include"},
debug_info]},
{version,"4.4.2"},
{time,{2007,1,23,12,4,54}},
{source,"/build/buildd/erlang-11.b.2/lib/kernel/src/zlib.erl"}]]

On Wed, 23 Jan 2008, Matthias Lang wrote:

> Matthew Dempsky writes:
> > On 1/22/08, Paul Mineiro <paul-trapexit@mineiro.com> wrote:
> > > Interestingly enough, removing either the first or last character from this binary eliminates the problem.
> >
> > I can't reproduce this with either R11B-5 or R12B-0, but I suspect the
> > word wrapping is at fault. Can you send this binary again, but using
> > the output from io:write/1?
>
> I can't reproduce it either, but I took some guesses about what the
> input data was (it got wrapped).
>
> Matthias
>

Optimism is an essential ingredient of innovation. How else can the
individual favor change over security?

-- Robert Noyce

Post recived from mailinglist
View user's profile Send private message Yahoo Messenger
Guest
Posted: Wed Jan 23, 2008 9:57 pm Reply with quote
Guest
Paul Mineiro writes:

> I can only reproduce this on a feisty box running 11b-2 (my bad, didn't
> notice the version difference at first). My mac has 11b-5 and doesn't have
> the problem.

> However, the problem under 11b-2 is data dependent so it's possible that
> it still exists under 11b-5 and we just don't know how to tickle it. Do
> you have an 11b-2 setup you can fire up to investigate?

It fails for me too on R11B-2 compiled from source on an x86 Debian
box (see below).

It works for R11B-4 and R11B-5.

>From the R11B-3 release notes:

OTP-6394 The version of zlib (http://zlib.net) linked into run-time
system has been updated to version 1.2.3.

It looks like R11B-2 uses zlib 1.1.4.

I had a bit of a go at debugging but lost interest. Basically I tried
to show that using zlib 1.1.4 directly would also fail to decompress
the data. But I failed to do that, which may be because it's late, or
because the problem is more subtle.

Matt

----------------------------------------------------------------------

tmp >/usr/local/src/otp_src_R11B-2/bin/erl
Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.5.2 (abort with ^G)
1> [ zlib:unzip (zlib:zip (Bin)) || { ok, Bin } <- [ file:read_file ("mega") ] ].
** exited: {data_error,[{zlib,call,3},
{zlib,unzip,1},
{erl_eval,do_apply,5},
{erl_eval,eval_lc1,5},
{lists,flatmap,2},
{erl_eval,eval_lc,6},
{shell,exprs,6},
{shell,eval_loop,3}]} **

=ERROR REPORT==== 23-Jan-2008::22:10:11 ===
Error in process <0.30.0> with exit value: {data_error,[{zlib,call,3},{zlib,unzip,1},{erl_eval,do_apply,5},{erl_eval,eval_lc1,5},{lists,flatmap,2},{erl_eval,eval_lc,6},{shell,exprs,6},{shell,eval_loop,3}]}
_______________________________________________
erlang-bugs mailing list
erlang-bugs@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-bugs
Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum