<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texte de bulles Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.TextedebullesCar
        {mso-style-name:"Texte de bulles Car";
        mso-style-priority:99;
        mso-style-link:"Texte de bulles";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I received a patch proposal for minizip at<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><a href="http://gvollant.free.fr/minizip_patch_derek_proposal.zip">http://gvollant.free.fr/minizip_patch_derek_proposal.zip</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>this look good for me, but before asking Mark to include it, I’ll be happy if you can test it<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>regards<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gilles Vollant<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De :</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Gilles Vollant [mailto:info@winimage.com] <br><b>Envoyé :</b> jeudi 9 février 2012 14:24<br><b>À :</b> Mark Adler <madler@madler.net> (madler@madler.net)<br><b>Objet :</b> TR: Minizip<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’ll take a look, I cc to you for info<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De :</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Derek Edson <a href="mailto:[mailto:Derek.Edson@sss.co.nz]">[mailto:Derek.Edson@sss.co.nz]</a> <br><b>Envoyé :</b> jeudi 9 février 2012 03:48<br><b>À :</b> <a href="mailto:info@winimage.com">info@winimage.com</a><br><b>Objet :</b> Minizip<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>I just downloaded and built minizip based on zlib-1.2.6</span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>I have a found a bug with unzip.c when extra attributes are present.  The existing code attempts to move back to the beginning of the extra attributes by using a negative offset to the current position, however the offset parameter is unsigned.  </span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>I was using a 32-bit filefunc, so ZSEEK64 fails on (offsetTruncated != offset), otherwise it would move to the end of file.</span> <br><br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>    if ((err==UNZ_OK) && (file_info.size_file_extra != 0))</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>    {</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                uLong acc = 0;</span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>        // since lSeek now points to after the extra field we need to move back</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>        lSeek -= file_info.size_file_extra;</span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>        if (lSeek!=0)</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                {</span> <br><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:red'>                        /* DNE: cannot move backwards as ZSEEK64 is unsigned</span></b> <br><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:red'>                                        so we need to get current positin and add lSeek ourselves</span></b> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:red'>                        if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:red'>                                lSeek=0;</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:red'>                        else</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:red'>                                err=UNZ_ERRNO;</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:red'>                        */</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                        ZPOS64_T cur = ZTELL64(s->z_filefunc,s->filestream);</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                        cur += lSeek;</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                        if (ZSEEK64(s->z_filefunc, s->filestream,cur,ZLIB_FILEFUNC_SEEK_SET)==0)</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                                lSeek=0;</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                        else</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                                err=UNZ_ERRNO;</span> <br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>                }</span> <br><br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>I have also modified the code to improve performance (unnecessary I/O).  </span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Both unzip.c and zip.c first search for the zip64 end of central directory locator, and only if this fails will it search for the normal zip end of central directory record. Given that most zip files being processed are more likely to be standard, rather than zip64, the code will unnecessarily search the last 64KB looking for a non-existant header.  </span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>The modified code now searches for the end of central directory record in all cases, which will more likely be found within the first 1KB.  </span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Only if the number of files exceeds 0xffff or the offset exceeds 0xffffffff does the modified code get the zip64 end of record locator.  Since this record is fixed length and is located immediately prior to the end of central directory record, it can be located without any more searching.  </span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>This also has an added advantage that the global comment size is read from the end of central directory record for both normal and zip64 files.</span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>The modified searching technique is now consistent with the way in which zip.c creates a zip64 file, that is it only writes the zip64 end of central directory record when the number of files or offset exceed the field sizes.</span> <br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thank you for producing this code, and attached is my modified version.</span> <br><br><br><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><br></span>Derek <span style='color:#1F497D'> </span> <o:p></o:p></p></div></body></html>