bug 603592 - Swap endianness on GUIDs when de-stringifying them. r=mwu, a=blocking-fennec
authorTed Mielczarek <ted.mielczarek@gmail.com>
Fri, 22 Oct 2010 14:38:58 -0400
changeset 56368 824f0cefa25d1460a7c8b4c63de015b8733ab359
parent 56367 28675757affa258fc2396153d2cf67f7e865ec35
child 56369 fff8f84d0f94e88b7ba898fdf0127f5c3cfbd13a
push id16508
push usertmielczarek@mozilla.com
push dateFri, 22 Oct 2010 18:39:36 +0000
treeherdermozilla-central@824f0cefa25d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu, blocking-fennec
bugs603592
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 603592 - Swap endianness on GUIDs when de-stringifying them. r=mwu, a=blocking-fennec
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -259,16 +259,23 @@ static std::vector<mapping_info> library
 void FileIDToGUID(const char* file_id, u_int8_t guid[sizeof(MDGUID)])
 {
   for (int i = 0; i < sizeof(MDGUID); i++) {
     int c;
     sscanf(file_id, "%02X", &c);
     guid[i] = (u_int8_t)(c & 0xFF);
     file_id += 2;
   }
+  // GUIDs are stored in network byte order.
+  uint32_t* data1 = reinterpret_cast<uint32_t*>(guid);
+  *data1 = htonl(*data1);
+  uint16_t* data2 = reinterpret_cast<uint16_t*>(guid + 4);
+  *data2 = htons(*data2);
+  uint16_t* data3 = reinterpret_cast<uint16_t*>(guid + 6);
+  *data3 = htons(*data3);
 }
 #endif
 
 #ifdef XP_LINUX
 inline void
 my_timetostring(time_t t, char* buffer, size_t buffer_length)
 {
   my_memset(buffer, 0, buffer_length);