mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-23 17:25:27 +00:00
Ignore functions that have invalid addresses or sizes, instead of aborting the
symbol file load (#137). r=mmentovai. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@130 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
6bc866cc82
commit
809f0cb858
|
@ -226,7 +226,7 @@ bool BasicSourceLineResolver::Module::LoadMap(const string &map_file) {
|
||||||
// lines, which might be present for FUNC lines of highly-templatized
|
// lines, which might be present for FUNC lines of highly-templatized
|
||||||
// code.
|
// code.
|
||||||
char buffer[8192];
|
char buffer[8192];
|
||||||
Function *cur_func = NULL;
|
linked_ptr<Function> cur_func;
|
||||||
|
|
||||||
while (fgets(buffer, sizeof(buffer), f)) {
|
while (fgets(buffer, sizeof(buffer), f)) {
|
||||||
if (strncmp(buffer, "FILE ", 5) == 0) {
|
if (strncmp(buffer, "FILE ", 5) == 0) {
|
||||||
|
@ -236,17 +236,17 @@ bool BasicSourceLineResolver::Module::LoadMap(const string &map_file) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (strncmp(buffer, "FUNC ", 5) == 0) {
|
} else if (strncmp(buffer, "FUNC ", 5) == 0) {
|
||||||
cur_func = ParseFunction(buffer);
|
cur_func.reset(ParseFunction(buffer));
|
||||||
if (!cur_func) {
|
if (!cur_func.get()) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!functions_.StoreRange(cur_func->address, cur_func->size,
|
|
||||||
linked_ptr<Function>(cur_func))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// StoreRange will fail if the function has an invalid address or size.
|
||||||
|
// We'll silently ignore this, the function and any corresponding lines
|
||||||
|
// will be destroyed when cur_func is released.
|
||||||
|
functions_.StoreRange(cur_func->address, cur_func->size, cur_func);
|
||||||
} else if (strncmp(buffer, "PUBLIC ", 7) == 0) {
|
} else if (strncmp(buffer, "PUBLIC ", 7) == 0) {
|
||||||
// Clear cur_func: public symbols don't contain line number information.
|
// Clear cur_func: public symbols don't contain line number information.
|
||||||
cur_func = NULL;
|
cur_func.reset();
|
||||||
|
|
||||||
if (!ParsePublicSymbol(buffer)) {
|
if (!ParsePublicSymbol(buffer)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -259,7 +259,7 @@ bool BasicSourceLineResolver::Module::LoadMap(const string &map_file) {
|
||||||
//
|
//
|
||||||
// MODULE <guid> <age> <filename>
|
// MODULE <guid> <age> <filename>
|
||||||
} else {
|
} else {
|
||||||
if (!cur_func) {
|
if (!cur_func.get()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Line *line = ParseLine(buffer);
|
Line *line = ParseLine(buffer);
|
||||||
|
|
|
@ -152,6 +152,10 @@ static bool RunTests() {
|
||||||
ASSERT_FALSE(frame_info->allocates_base_pointer);
|
ASSERT_FALSE(frame_info->allocates_base_pointer);
|
||||||
ASSERT_FALSE(frame_info->program_string.empty());
|
ASSERT_FALSE(frame_info->program_string.empty());
|
||||||
|
|
||||||
|
frame.instruction = 0x2000;
|
||||||
|
frame_info.reset(resolver.FillSourceLineInfo(&frame));
|
||||||
|
ASSERT_FALSE(frame_info.get());
|
||||||
|
|
||||||
TestCodeModule module2("module2");
|
TestCodeModule module2("module2");
|
||||||
|
|
||||||
frame.instruction = 0x2181;
|
frame.instruction = 0x2181;
|
||||||
|
@ -186,8 +190,11 @@ static bool RunTests() {
|
||||||
testdata_dir + "/module3_bad.out"));
|
testdata_dir + "/module3_bad.out"));
|
||||||
ASSERT_FALSE(resolver.HasModule("module3"));
|
ASSERT_FALSE(resolver.HasModule("module3"));
|
||||||
ASSERT_FALSE(resolver.LoadModule("module4",
|
ASSERT_FALSE(resolver.LoadModule("module4",
|
||||||
testdata_dir + "/invalid-filename"));
|
testdata_dir + "/module4_bad.out"));
|
||||||
ASSERT_FALSE(resolver.HasModule("module4"));
|
ASSERT_FALSE(resolver.HasModule("module4"));
|
||||||
|
ASSERT_FALSE(resolver.LoadModule("module5",
|
||||||
|
testdata_dir + "/invalid-filename"));
|
||||||
|
ASSERT_FALSE(resolver.HasModule("module5"));
|
||||||
ASSERT_FALSE(resolver.HasModule("invalid-module"));
|
ASSERT_FALSE(resolver.HasModule("invalid-module"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
2
src/processor/testdata/module1.out
vendored
2
src/processor/testdata/module1.out
vendored
|
@ -11,6 +11,8 @@ FUNC 1100 8 4 Function1_2
|
||||||
1104 4 66 2
|
1104 4 66 2
|
||||||
FUNC 1200 100 8 Function1_3
|
FUNC 1200 100 8 Function1_3
|
||||||
FUNC 1300 100 c Function1_4
|
FUNC 1300 100 c Function1_4
|
||||||
|
FUNC 2000 0 0 Test_Zero_Size_Function_Is_Ignored
|
||||||
|
2000 4 88 2
|
||||||
STACK WIN 4 1000 c 1 0 0 0 0 0 1 $eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ =
|
STACK WIN 4 1000 c 1 0 0 0 0 0 1 $eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ =
|
||||||
STACK WIN 4 1100 8 1 0 0 0 0 0 1 $eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ =
|
STACK WIN 4 1100 8 1 0 0 0 0 0 1 $eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ =
|
||||||
STACK WIN 4 1100 100 1 0 0 0 0 0 1 $eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ =
|
STACK WIN 4 1100 100 1 0 0 0 0 0 1 $eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ =
|
||||||
|
|
5
src/processor/testdata/module4_bad.out
vendored
Normal file
5
src/processor/testdata/module4_bad.out
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
MODULE windows x86 444444444444444444444444444444444 module4.pdb
|
||||||
|
FILE 1 file4_1.cc
|
||||||
|
FILE 2 file4_2.cc
|
||||||
|
1000 4 44 1
|
||||||
|
1004 4 45 1
|
Loading…
Reference in a new issue