LLVM changed some of their logic for StringRefs and did not notice that this broke parsing PE files. We notice, of course, since we *do* parse PE files :)

Hence, the win32 tinderbox is broken.

This is the fix. I'm landing it on the tinderboxes presently since I'm about to leave and don't have time to get it upstream. Hope someone can do so while I'm gone, I'll update back to LLVM trunk when it lands there.

-Graydon


Index: lib/Object/COFFObjectFile.cpp
===================================================================
--- lib/Object/COFFObjectFile.cpp       (revision 134402)
+++ lib/Object/COFFObjectFile.cpp       (working copy)
@@ -309,8 +309,10 @@
     if (!checkSize(Data, ec, 0x3c + 8)) return;
     HeaderStart += *reinterpret_cast<const ulittle32_t *>(base() + 0x3c);
     // Check the PE header. ("PE\0\0")
-    if (StringRef(reinterpret_cast<const char *>(base() + HeaderStart), 4)
-        != "PE\0\0") {
+    if ((base() + HeaderStart)[0] != 'P' ||
+        (base() + HeaderStart)[1] != 'E' ||
+        (base() + HeaderStart)[2] != '\0' ||
+        (base() + HeaderStart)[3] != '\0') {
       ec = object_error::parse_failed;
       return;
     }
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to