Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect stack trace for stripped binaries #1092

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/symbolize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -642,18 +642,13 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
return nullptr; // Malformed line.
}

strncpy(out_file_name, cursor, out_file_name_size);
// Making sure |out_file_name| is always null-terminated.
out_file_name[out_file_name_size - 1] = '\0';

// Finally, "cursor" now points to file name of our interest.
FileDescriptor object_fd{
return FileDescriptor{
FailureRetry([cursor] { return open(cursor, O_RDONLY); })};
if (!object_fd) {
// Failed to open object file. Copy the object file name to
// |out_file_name|.
strncpy(out_file_name, cursor, out_file_name_size);
// Making sure |out_file_name| is always null-terminated.
out_file_name[out_file_name_size - 1] = '\0';
return nullptr;
}
return object_fd;
}
}

Expand Down