Fix possible null pointer dereference in MinidumpModule (following #32).

r=waylonis

http://groups.google.com/group/airbag-dev/browse_thread/thread/b684b775078d91ca


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@76 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2006-12-06 05:03:48 +00:00
parent daf4211942
commit 28e5990b57

View file

@ -1146,9 +1146,9 @@ string MinidumpModule::debug_file() const {
string file;
// Prefer the CodeView record if present.
if (cv_record_) {
const MDCVInfoPDB70* cv_record_70 =
reinterpret_cast<const MDCVInfoPDB70*>(&(*cv_record_)[0]);
if (cv_record_70) {
if (cv_record_70->cv_signature == MD_CVINFOPDB70_SIGNATURE) {
// GetCVRecord guarantees pdb_file_name is null-terminated.
file = reinterpret_cast<const char*>(cv_record_70->pdb_file_name);
@ -1169,9 +1169,9 @@ string MinidumpModule::debug_file() const {
if (file.empty()) {
// No usable CodeView record. Try the miscellaneous debug record.
if (misc_record_) {
const MDImageDebugMisc* misc_record =
reinterpret_cast<const MDImageDebugMisc *>(&(*misc_record_)[0]);
if (misc_record) {
if (!misc_record->unicode) {
// If it's not Unicode, just stuff it into the string. It's unclear
// if misc_record->data is 0-terminated, so use an explicit size.
@ -1216,9 +1216,9 @@ string MinidumpModule::debug_identifier() const {
string identifier;
// Use the CodeView record if present.
if (cv_record_) {
const MDCVInfoPDB70* cv_record_70 =
reinterpret_cast<const MDCVInfoPDB70*>(&(*cv_record_)[0]);
if (cv_record_70) {
if (cv_record_70->cv_signature == MD_CVINFOPDB70_SIGNATURE) {
char identifier_string[41];
snprintf(identifier_string, sizeof(identifier_string),