<div dir="ltr">Yes I can. Will do.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 5, 2015 at 7:20 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can we add a test with a file created by a buggy writer?<br>
<div class="HOEnZb"><div class="h5"><br>
On 3 July 2015 at 23:25, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> Author: ruiu<br>
> Date: Fri Jul 3 22:25:51 2015<br>
> New Revision: 241387<br>
><br>
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D241387-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=p2JLdp1wuRbzj6SWkwv-zLAvGZ2O-WtDAe4jO4eBt4E&s=XwMYouStO-OMcCVTTPSt4uyagIPjag09sE91eHdNEv0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=241387&view=rev</a><br>
> Log:<br>
> Object/COFF: Do not rely on VirtualSize being 0 in object files.<br>
><br>
> Modified:<br>
> llvm/trunk/lib/Object/COFFObjectFile.cpp<br>
><br>
> Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp<br>
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Object_COFFObjectFile.cpp-3Frev-3D241387-26r1-3D241386-26r2-3D241387-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=p2JLdp1wuRbzj6SWkwv-zLAvGZ2O-WtDAe4jO4eBt4E&s=rZZ9dWsqETYoOjW0GeEP0E-2gaUWK6z6-NXCiSCWLKo&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=241387&r1=241386&r2=241387&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)<br>
> +++ llvm/trunk/lib/Object/COFFObjectFile.cpp Fri Jul 3 22:25:51 2015<br>
> @@ -918,19 +918,15 @@ uint64_t COFFObjectFile::getSectionSize(<br>
> // whether or not we have an executable image.<br>
> //<br>
> // For object files, SizeOfRawData contains the size of section's data;<br>
> - // VirtualSize is always zero.<br>
> + // VirtualSize should be zero but isn't due to buggy COFF writers.<br>
> //<br>
> // For executables, SizeOfRawData *must* be a multiple of FileAlignment; the<br>
> // actual section size is in VirtualSize. It is possible for VirtualSize to<br>
> // be greater than SizeOfRawData; the contents past that point should be<br>
> // considered to be zero.<br>
> - uint32_t SectionSize;<br>
> - if (Sec->VirtualSize)<br>
> - SectionSize = std::min(Sec->VirtualSize, Sec->SizeOfRawData);<br>
> - else<br>
> - SectionSize = Sec->SizeOfRawData;<br>
> -<br>
> - return SectionSize;<br>
> + if (getDOSHeader())<br>
> + return std::min(Sec->VirtualSize, Sec->SizeOfRawData);<br>
> + return Sec->SizeOfRawData;<br>
> }<br>
><br>
> std::error_code<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>