Bug 9536 - unzip: invalid zip magic 00000597
Summary: unzip: invalid zip magic 00000597
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-29 14:59 UTC by Ale
Modified: 2017-01-19 16:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
File that exhibit the problem (12.83 KB, application/zip)
2016-12-29 14:59 UTC, Ale
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ale 2016-12-29 14:59:50 UTC
Created attachment 6836 [details]
File that exhibit the problem

When extracting the attached file it say:
unzip: invalid zip magic 00000597

It extract the files but it return error code 1 so my script give error although the extraction was done.
Comment 1 Denys Vlasenko 2017-01-03 13:15:05 UTC
It gets confused by this binary blob after the last file:

00002be0  97 05 00 00 00 00 00 00  77 05 00 00 00 00 00 00  |........w.......|
00002bf0  1a 87 09 71 6f 05 00 00  6b 05 00 00 2d 03 00 00  |...qo...k...-...|
00002c00  2c 00 00 00 28 00 00 00  03 01 00 00 20 00 00 00  |,...(....... ...|
00002c10  8e 9d 26 2f 97 f6 7b 77  9d c8 60 d3 c2 2f 61 2f  |..&/..{w..`../a/|
00002c20  72 43 72 20 11 67 c1 e3  aa 5b 74 17 24 e3 df 2c  |rCr .g...[t.$..,|
00002c30  f5 02 00 00 f1 02 00 00  30 82 02 ed 30 82 01 d5  |........0...0...|
00002c40  a0 03 02 01 02 02 04 26  ff a0 09 30 0d 06 09 2a  |.......&...0...*|
00002c50  86 48 86 f7 0d 01 01 0b  05 00 30 27 31 0b 30 09  |.H........0'1.0.|
00002c60  06 03 55 04 06 13 02 44  45 31 18 30 16 06 03 55  |..U....DE1.0...U|
00002c70  04 0a 13 0f 4e 4f 47 41  50 50 53 20 50 72 6f 6a  |....NOGAPPS Proj|
00002c80  65 63 74 30 1e 17 0d 31  32 31 30 30 36 31 32 30  |ect0...121006120|
00002c90  35 33 32 5a 17 0d 33 37  30 39 33 30 31 32 30 35  |532Z..3709301205|
00002ca0  33 32 5a 30 27 31 0b 30  09 06 03 55 04 06 13 02  |32Z0'1.0...U....|
00002cb0  44 45 31 18 30 16 06 03  55 04 0a 13 0f 4e 4f 47  |DE1.0...U....NOG|
00002cc0  41 50 50 53 20 50 72 6f  6a 65 63 74 30 82 01 22  |APPS Project0.."|
00002cd0  30 0d 06 09 2a 86 48 86  f7 0d 01 01 01 05 00 03  |0...*.H.........|
00002ce0  82 01 0f 00 30 82 01 0a  02 82 01 01 00 9a 8d 2a  |....0..........*|
00002cf0  53 36 b0 ea aa d8 9c e4  47 82 8c 77 53 b1 57 45  |S6......G..wS.WE|
00002d00  9b 79 e3 21 5d c9 62 ca  48 f5 8c 2c d7 65 0d f6  |.y.!].b.H..,.e..|
00002d10  7d 2d d7 bd a0 88 0c 68  27 91 f3 2b 35 c5 04 e4  |}-.....h'..+5...|
00002d20  3e 77 b4 3c 3e 4e 54 1f  86 e3 5a 82 93 a5 4f b4  |>w.<>NT...Z...O.|
00002d30  6e 6b 16 af 54 d3 a4 ed  a4 58 f1 a7 c8 bc 1b 74  |nk..T....X.....t|
00002d40  79 86 1c a7 04 33 37 18  0e 40 07 9d 9c dc cb 7e  |y....37..@.....~|
00002d50  05 1a da 9b 6c 88 c9 ec  63 55 41 e2 eb f0 84 25  |....l...cUA....%|
00002d60  21 c3 02 4c 82 6f 6f d6  db 6f d1 17 c7 4e 85 9d  |!..L.oo..o...N..|
00002d70  5a f4 db 04 44 89 65 ab  54 69 b7 1c e7 19 93 9a  |Z...D.e.Ti......|
00002d80  06 ef 30 58 0f 50 fe bf  96 c4 74 a7 d2 65 bb 63  |..0X.P....t..e.c|
00002d90  f8 6a 82 2f f7 b6 43 de  6b 76 e9 66 a1 85 53 c2  |.j./..C.kv.f..S.|
00002da0  85 84 16 cf 33 09 dd 24  27 83 74 bd d8 2b 44 04  |....3..$'.t..+D.|
00002db0  ef 6f 7f 12 2c ec 93 85  93 51 fc 6e 5e a9 47 e3  |.o..,....Q.n^.G.|
00002dc0  ce b9 d6 73 74 fe 97 0e  59 3e 5c d0 5c 90 5e 1d  |...st...Y>\.\.^.|
00002dd0  24 f5 a5 48 4f 4a ad ef  76 6e 49 8a df 64 f7 cf  |$..HOJ..vnI..d..|
00002de0  04 bd dd 60 2a e8 13 7b  6e ea 40 72 2d 02 03 01  |...`*..{n.@r-...|
00002df0  00 01 a3 21 30 1f 30 1d  06 03 55 1d 0e 04 16 04  |...!0.0...U.....|
00002e00  14 11 0b 7a a9 eb c8 40  b2 03 99 f6 9a 43 1f 4d  |...z...@.....C.M|
00002e10  ba 6a c4 2a 64 30 0d 06  09 2a 86 48 86 f7 0d 01  |.j.*d0...*.H....|
00002e20  01 0b 05 00 03 82 01 01  00 07 c3 2a d8 93 34 9c  |...........*..4.|
00002e30  f8 69 52 fb 5a 49 cf dc  9b 13 f5 e3 c8 00 ae ce  |.iR.ZI..........|
00002e40  77 b2 e7 e0 e9 c8 3e 34  05 2f 14 0f 35 7e c7 e6  |w.....>4./..5~..|
00002e50  f4 b4 32 dc 1e d5 42 21  8a 14 83 5a cd 2d f2 de  |..2...B!...Z.-..|
00002e60  ea 7e fd 3f d5 e8 f1 c3  4e 1f b3 9e c6 a4 27 c6  |.~.?....N.....'.|
00002e70  e6 f4 17 8b 60 9b 36 90  40 ac 1f 88 44 b7 89 f3  |....`.6.@...D...|
00002e80  69 4d c6 40 de 06 e4 4b  24 7a fe d1 16 37 17 3f  |iM.@...K$z...7.?|
00002e90  36 f5 88 61 70 fa fd 74  95 40 49 85 8c 60 96 30  |6..ap..t.@I..`.0|
00002ea0  8f c9 3c 1b c4 dd 56 85  fa 7a 1f 98 2a 42 2f 2a  |..<...V..z..*B/*|
00002eb0  3b 36 ba a8 c9 50 04 74  cf 2a f9 1c 39 cb ec 1b  |;6...P.t.*..9...|
00002ec0  c8 98 d1 01 94 d3 68 aa  5e 91 f1 13 7e c1 15 08  |......h.^...~...|
00002ed0  7c 31 96 2d 8f 76 cd 12  0d 28 c2 49 cf 76 f4 c7  ||1.-.v...(.I.v..|
00002ee0  0f 5b aa 08 c7 0a 72 34  ce 41 23 be 08 0c ee 78  |.[....r4.A#....x|
00002ef0  94 77 40 19 65 cf e5 37  b9 24 ef 36 74 7e 8c ac  |.w@.e..7.$.6t~..|
00002f00  a6 2d fe fd d1 a6 28 8d  cb 1c 4f d2 aa a6 13 1a  |.-....(...O.....|
00002f10  7a d2 54 e9 74 20 22 cf  d5 97 d2 ca 5c 66 0c e9  |z.T.t ".....\f..|
00002f20  e4 1f f5 37 e5 a4 04 1e  37 00 00 00 00 0c 01 00  |...7....7.......|
00002f30  00 08 01 00 00 03 01 00  00 00 01 00 00 5f 9c cb  |............._..|
00002f40  a5 4d cb ba 16 fb ce 4e  54 c5 9f 2b b7 90 da 2b  |.M.....NT..+...+|
00002f50  10 a3 b2 90 34 3d 4b 1c  95 d1 98 4c b6 73 39 6c  |....4=K....L.s9l|
00002f60  f0 20 aa f6 6c ed 88 53  54 7d 4f 75 f5 89 c0 12  |. ..l..ST}Ou....|
00002f70  d0 29 fc 76 bc 3b d7 82  a4 70 75 e0 a9 36 56 1d  |.).v.;...pu..6V.|
00002f80  b0 2b 18 fa 06 65 52 99  30 62 12 7c 91 5a 65 99  |.+...eR.0b.|.Ze.|
00002f90  33 28 fc 3a 24 ed ab d0  9c 91 8a 71 b0 ba 18 21  |3(.:$......q...!|
00002fa0  84 3c ca 6d 16 c4 c0 d6  9a eb f2 a5 b9 25 42 ac  |.<.m.........%B.|
00002fb0  d1 22 21 90 76 d3 76 15  ba 58 1a 1a 18 fa 37 7a  |."!.v.v..X....7z|
00002fc0  5b 52 cc 85 61 1a 72 dd  d8 46 7a 80 1f c8 d9 fc  |[R..a.r..Fz.....|
00002fd0  5b b4 b0 c2 a1 a8 47 51  55 0c cf b5 e6 23 b9 87  |[.....GQU....#..|
00002fe0  2a 91 89 0e 09 27 dd 71  58 ab e7 ce ad 58 85 dd  |*....'.qX....X..|
00002ff0  62 bb 35 e7 c0 f8 d6 47  4c aa 16 3b de ac b5 93  |b.5....GL..;....|
00003000  4b 6b 23 85 ce c4 3c 76  d8 24 bc 79 c8 1e ed be  |Kk#...<v.$.y....|
00003010  6d 7c 5d 6b 6e 39 a4 f9  fa cc 2a e7 84 30 5f e4  |m|]kn9....*..0_.|
00003020  e4 29 f7 88 e7 0c 31 ad  a4 e7 e8 62 fb e7 92 ad  |.)....1....b....|
00003030  6f e4 d8 34 6b 38 a9 7b  7f f8 36 f5 87 26 01 00  |o..4k8.{..6..&..|
00003040  00 30 82 01 22 30 0d 06  09 2a 86 48 86 f7 0d 01  |.0.."0...*.H....|
00003050  01 01 05 00 03 82 01 0f  00 30 82 01 0a 02 82 01  |.........0......|
00003060  01 00 9a 8d 2a 53 36 b0  ea aa d8 9c e4 47 82 8c  |....*S6......G..|
00003070  77 53 b1 57 45 9b 79 e3  21 5d c9 62 ca 48 f5 8c  |wS.WE.y.!].b.H..|
00003080  2c d7 65 0d f6 7d 2d d7  bd a0 88 0c 68 27 91 f3  |,.e..}-.....h'..|
00003090  2b 35 c5 04 e4 3e 77 b4  3c 3e 4e 54 1f 86 e3 5a  |+5...>w.<>NT...Z|
000030a0  82 93 a5 4f b4 6e 6b 16  af 54 d3 a4 ed a4 58 f1  |...O.nk..T....X.|
000030b0  a7 c8 bc 1b 74 79 86 1c  a7 04 33 37 18 0e 40 07  |....ty....37..@.|
000030c0  9d 9c dc cb 7e 05 1a da  9b 6c 88 c9 ec 63 55 41  |....~....l...cUA|
000030d0  e2 eb f0 84 25 21 c3 02  4c 82 6f 6f d6 db 6f d1  |....%!..L.oo..o.|
000030e0  17 c7 4e 85 9d 5a f4 db  04 44 89 65 ab 54 69 b7  |..N..Z...D.e.Ti.|
000030f0  1c e7 19 93 9a 06 ef 30  58 0f 50 fe bf 96 c4 74  |.......0X.P....t|
00003100  a7 d2 65 bb 63 f8 6a 82  2f f7 b6 43 de 6b 76 e9  |..e.c.j./..C.kv.|
00003110  66 a1 85 53 c2 85 84 16  cf 33 09 dd 24 27 83 74  |f..S.....3..$'.t|
00003120  bd d8 2b 44 04 ef 6f 7f  12 2c ec 93 85 93 51 fc  |..+D..o..,....Q.|
00003130  6e 5e a9 47 e3 ce b9 d6  73 74 fe 97 0e 59 3e 5c  |n^.G....st...Y>\|
00003140  d0 5c 90 5e 1d 24 f5 a5  48 4f 4a ad ef 76 6e 49  |.\.^.$..HOJ..vnI|
00003150  8a df 64 f7 cf 04 bd dd  60 2a e8 13 7b 6e ea 40  |..d.....`*..{n.@|
00003160  72 2d 02 03 01 00 01 97  05 00 00 00 00 00 00 41  |r-.............A|
00003170  50 4b 20 53 69 67 20 42  6c 6f 63 6b 20 34 32     |PK Sig Block 42
Comment 2 Denys Vlasenko 2017-01-05 10:44:53 UTC
Fixed in git, please try int and reopen if the problem persists
Comment 3 Ron Yorston 2017-01-05 14:47:55 UTC
Busybox from latest git doesn't correctly extract the supplied zip file.  The files res/drawable/icon.png and resources.arsc have a few bytes of garbage at the start.

It appears that the comment in the code 'CDF has the same data as local header, no need to read the latter' is not true for these files.  The CDF has extra_len == 6 where the local header has extra_len == 0.

The ifdef'ed out code which uses the CDF extracts the files correctly.
Comment 4 Ron Yorston 2017-01-05 14:52:27 UTC
s/uses the CDF/uses the local header/
Comment 5 Denys Vlasenko 2017-01-08 13:16:10 UTC
Thanks for testing!

Fixed in git #2, please try int and reopen if the problem persists
Comment 6 Ron Yorston 2017-01-08 15:01:58 UTC
Thanks Denys.

It seems it's OK for the central directory and local header to have different extra data.  I found at least two zip files on my system (in addition to the example here) where that was the case.  All worked with the latest fix.
Comment 7 Ale 2017-01-08 15:49:23 UTC
Thanks for the fixes :)
Comment 8 Ale 2017-01-18 19:12:09 UTC
Hi,
this fix seems to me rather important.

Is it possible to port it in the stable branch?
Comment 9 Denys Vlasenko 2017-01-19 13:03:22 UTC
Done.
Comment 10 Ale 2017-01-19 16:39:19 UTC
Thanks :)