Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1203)

Unified Diff: src/processor/minidump.cc

Issue 1271543002: Fix potential null pointer dereference. (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/google_breakpad/processor/minidump.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/processor/minidump.cc
===================================================================
--- src/processor/minidump.cc (revision 1477)
+++ src/processor/minidump.cc (working copy)
@@ -3999,15 +3999,17 @@
}
MinidumpLinuxMapsList::~MinidumpLinuxMapsList() {
- for (unsigned int i = 0; i < maps_->size(); i++) {
- delete (*maps_)[i];
+ if (maps_) {
+ for (unsigned int i = 0; i < maps_->size(); i++) {
+ delete (*maps_)[i];
+ }
+ delete maps_;
}
- delete maps_;
}
const MinidumpLinuxMaps *MinidumpLinuxMapsList::GetLinuxMapsForAddress(
uint64_t address) const {
- if (!valid_) {
+ if (!valid_ || (maps_ == NULL)) {
BPLOG(ERROR) << "Invalid MinidumpLinuxMapsList for GetLinuxMapsForAddress";
return NULL;
}
@@ -4029,13 +4031,13 @@
const MinidumpLinuxMaps *MinidumpLinuxMapsList::GetLinuxMapsAtIndex(
unsigned int index) const {
- if (!valid_) {
+ if (!valid_ || (maps_ == NULL)) {
BPLOG(ERROR) << "Invalid MinidumpLinuxMapsList for GetLinuxMapsAtIndex";
return NULL;
}
// Index out of bounds.
- if (index >= maps_count_) {
+ if (index >= maps_count_ || (maps_ == NULL)) {
BPLOG(ERROR) << "MinidumpLinuxMapsList index of out range: "
<< index
<< "/"
@@ -4047,7 +4049,12 @@
bool MinidumpLinuxMapsList::Read(uint32_t expected_size) {
// Invalidate cached data.
- delete maps_;
+ if (maps_) {
+ for (unsigned int i = 0; i < maps_->size(); i++) {
+ delete (*maps_)[i];
+ }
+ delete maps_;
+ }
maps_ = NULL;
maps_count_ = 0;
@@ -4100,7 +4107,7 @@
}
void MinidumpLinuxMapsList::Print() {
- if (!valid_) {
+ if (!valid_ || (maps_ == NULL)) {
BPLOG(ERROR) << "MinidumpLinuxMapsList cannot print valid data";
return;
}
« no previous file with comments | « src/google_breakpad/processor/minidump.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698