mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 599475 - Fix crash reporting on MacOS 10.5 (Leopard) by making breakpad use it's internal implementation of MD5 instead of one randomly picked from libnss or libcrypto which isn't loading properly. r=ted a=blocking-beta8+
This commit is contained in:
parent
a09905d6a5
commit
53205f2ce6
@ -53,19 +53,19 @@ bool FileID::FileIdentifier(unsigned char identifier[16]) {
|
||||
if (fd == -1)
|
||||
return false;
|
||||
|
||||
MD5_CTX md5;
|
||||
MD5_Init(&md5);
|
||||
MD5Context md5;
|
||||
MD5Init(&md5);
|
||||
|
||||
// Read 4k x 2 bytes at a time. This is faster than just 4k bytes, but
|
||||
// doesn't seem to be an unreasonable size for the stack.
|
||||
unsigned char buffer[4096 * 2];
|
||||
size_t buffer_size = sizeof(buffer);
|
||||
while ((buffer_size = read(fd, buffer, buffer_size) > 0)) {
|
||||
MD5_Update(&md5, buffer, buffer_size);
|
||||
MD5Update(&md5, buffer, buffer_size);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
MD5_Final(identifier, &md5);
|
||||
MD5Final(identifier, &md5);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ extern "C" { // necessary for Leopard
|
||||
#include <fcntl.h>
|
||||
#include <mach-o/loader.h>
|
||||
#include <mach-o/swap.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -47,6 +46,7 @@ extern "C" { // necessary for Leopard
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include "common/md5.h"
|
||||
#include "common/mac/macho_id.h"
|
||||
#include "common/mac/macho_walker.h"
|
||||
#include "common/mac/macho_utilities.h"
|
||||
@ -117,7 +117,7 @@ void MachoID::UpdateCRC(unsigned char *bytes, size_t size) {
|
||||
}
|
||||
|
||||
void MachoID::UpdateMD5(unsigned char *bytes, size_t size) {
|
||||
MD5_Update(&md5_context_, bytes, size);
|
||||
MD5Update(&md5_context_, bytes, size);
|
||||
}
|
||||
|
||||
void MachoID::UpdateSHA1(unsigned char *bytes, size_t size) {
|
||||
@ -225,17 +225,14 @@ bool MachoID::MD5(int cpu_type, unsigned char identifier[16]) {
|
||||
MachoWalker walker(path_, WalkerCB, this);
|
||||
update_function_ = &MachoID::UpdateMD5;
|
||||
|
||||
if (MD5_Init(&md5_context_)) {
|
||||
MD5Init(&md5_context_);
|
||||
if (!walker.WalkHeader(cpu_type))
|
||||
return false;
|
||||
|
||||
MD5_Final(identifier, &md5_context_);
|
||||
MD5Final(identifier, &md5_context_);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MachoID::SHA1(int cpu_type, unsigned char identifier[16]) {
|
||||
MachoWalker walker(path_, WalkerCB, this);
|
||||
update_function_ = &MachoID::UpdateSHA1;
|
||||
|
@ -36,9 +36,10 @@
|
||||
|
||||
#include <limits.h>
|
||||
#include <mach-o/loader.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include "common/md5.h"
|
||||
|
||||
namespace MacFileUtilities {
|
||||
|
||||
class MachoWalker;
|
||||
@ -110,7 +111,7 @@ class MachoID {
|
||||
uint32_t crc_;
|
||||
|
||||
// The MD5 context
|
||||
MD5_CTX md5_context_;
|
||||
MD5Context md5_context_;
|
||||
|
||||
// The SHA1 context
|
||||
SHA_CTX sha1_context_;
|
||||
|
Loading…
Reference in New Issue
Block a user