From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/processor/exploitability_linux.cc | 68 +++++++++++++++++------------------ 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'src/processor/exploitability_linux.cc') diff --git a/src/processor/exploitability_linux.cc b/src/processor/exploitability_linux.cc index ccc9f145..798056df 100644 --- a/src/processor/exploitability_linux.cc +++ b/src/processor/exploitability_linux.cc @@ -77,13 +77,13 @@ const unsigned int MAX_OBJDUMP_BUFFER_LEN = 4096; namespace google_breakpad { -ExploitabilityLinux::ExploitabilityLinux(Minidump *dump, - ProcessState *process_state) +ExploitabilityLinux::ExploitabilityLinux(Minidump* dump, + ProcessState* process_state) : Exploitability(dump, process_state), enable_objdump_(false) { } -ExploitabilityLinux::ExploitabilityLinux(Minidump *dump, - ProcessState *process_state, +ExploitabilityLinux::ExploitabilityLinux(Minidump* dump, + ProcessState* process_state, bool enable_objdump) : Exploitability(dump, process_state), enable_objdump_(enable_objdump) { } @@ -111,12 +111,12 @@ ExploitabilityRating ExploitabilityLinux::CheckPlatformExploitability() { } // Getting exception data. (It should exist for all minidumps.) - MinidumpException *exception = dump_->GetException(); + MinidumpException* exception = dump_->GetException(); if (exception == NULL) { BPLOG(INFO) << "No exception record."; return EXPLOITABILITY_ERR_PROCESSING; } - const MDRawExceptionStream *raw_exception_stream = exception->exception(); + const MDRawExceptionStream* raw_exception_stream = exception->exception(); if (raw_exception_stream == NULL) { BPLOG(INFO) << "No raw exception stream."; return EXPLOITABILITY_ERR_PROCESSING; @@ -132,7 +132,7 @@ ExploitabilityRating ExploitabilityLinux::CheckPlatformExploitability() { uint64_t instruction_ptr = 0; uint64_t stack_ptr = 0; - const MinidumpContext *context = exception->GetContext(); + const MinidumpContext* context = exception->GetContext(); if (context == NULL) { BPLOG(INFO) << "No exception context."; return EXPLOITABILITY_ERR_PROCESSING; @@ -174,8 +174,8 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { BPLOG(INFO) << "MinGW does not support fork and exec. Terminating method."; #else // Get memory region containing instruction pointer. - MinidumpMemoryList *memory_list = dump_->GetMemoryList(); - MinidumpMemoryRegion *memory_region = + MinidumpMemoryList* memory_list = dump_->GetMemoryList(); + MinidumpMemoryRegion* memory_region = memory_list ? memory_list->GetMemoryRegionForAddress(instruction_ptr) : NULL; if (!memory_region) { @@ -185,15 +185,15 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { // Get exception data to find architecture. string architecture = ""; - MinidumpException *exception = dump_->GetException(); + MinidumpException* exception = dump_->GetException(); // This should never evaluate to true, since this should not be reachable // without checking for exception data earlier. if (!exception) { BPLOG(INFO) << "No exception data."; return false; } - const MDRawExceptionStream *raw_exception_stream = exception->exception(); - const MinidumpContext *context = exception->GetContext(); + const MDRawExceptionStream* raw_exception_stream = exception->exception(); + const MinidumpContext* context = exception->GetContext(); // This should not evaluate to true, for the same reason mentioned above. if (!raw_exception_stream || !context) { BPLOG(INFO) << "No exception or architecture data."; @@ -217,7 +217,7 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { // Get memory region around instruction pointer and the number of bytes // before and after the instruction pointer in the memory region. - const uint8_t *raw_memory = memory_region->GetMemory(); + const uint8_t* raw_memory = memory_region->GetMemory(); const uint64_t base = memory_region->GetBase(); if (base > instruction_ptr) { BPLOG(ERROR) << "Memory region base value exceeds instruction pointer."; @@ -275,9 +275,9 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { } #ifndef _WIN32 -bool ExploitabilityLinux::CalculateAddress(const string &address_expression, - const DumpContext &context, - uint64_t *write_address) { +bool ExploitabilityLinux::CalculateAddress(const string& address_expression, + const DumpContext& context, + uint64_t* write_address) { // The destination should be the format reg+a or reg-a, where reg // is a register and a is a hexadecimal constant. Although more complex // expressions can make valid instructions, objdump's disassembly outputs @@ -395,8 +395,8 @@ bool ExploitabilityLinux::CalculateAddress(const string &address_expression, // static bool ExploitabilityLinux::GetObjdumpInstructionLine( - const char *objdump_output_buffer, - string *instruction_line) { + const char* objdump_output_buffer, + string* instruction_line) { // Put buffer data into stream to output line-by-line. std::stringstream objdump_stream; objdump_stream.str(string(objdump_output_buffer)); @@ -420,10 +420,10 @@ bool ExploitabilityLinux::GetObjdumpInstructionLine( return true; } -bool ExploitabilityLinux::TokenizeObjdumpInstruction(const string &line, - string *operation, - string *dest, - string *src) { +bool ExploitabilityLinux::TokenizeObjdumpInstruction(const string& line, + string* operation, + string* dest, + string* src) { if (!operation || !dest || !src) { BPLOG(ERROR) << "Null parameters passed."; return false; @@ -483,10 +483,10 @@ bool ExploitabilityLinux::TokenizeObjdumpInstruction(const string &line, return true; } -bool ExploitabilityLinux::DisassembleBytes(const string &architecture, - const uint8_t *raw_bytes, +bool ExploitabilityLinux::DisassembleBytes(const string& architecture, + const uint8_t* raw_bytes, const unsigned int buffer_len, - char *objdump_output_buffer) { + char* objdump_output_buffer) { if (!raw_bytes || !objdump_output_buffer) { BPLOG(ERROR) << "Bad input parameters."; return false; @@ -514,7 +514,7 @@ bool ExploitabilityLinux::DisassembleBytes(const string &architecture, "objdump -D -b binary -M intel -m %s %s", architecture.c_str(), raw_bytes_tmpfile); - FILE *objdump_fp = popen(cmd, "r"); + FILE* objdump_fp = popen(cmd, "r"); if (!objdump_fp) { fclose(objdump_fp); unlink(raw_bytes_tmpfile); @@ -534,12 +534,12 @@ bool ExploitabilityLinux::DisassembleBytes(const string &architecture, #endif // _WIN32 bool ExploitabilityLinux::StackPointerOffStack(uint64_t stack_ptr) { - MinidumpLinuxMapsList *linux_maps_list = dump_->GetLinuxMapsList(); + MinidumpLinuxMapsList* linux_maps_list = dump_->GetLinuxMapsList(); // Inconclusive if there are no mappings available. if (!linux_maps_list) { return false; } - const MinidumpLinuxMaps *linux_maps = + const MinidumpLinuxMaps* linux_maps = linux_maps_list->GetLinuxMapsForAddress(stack_ptr); // Checks if the stack pointer maps to a valid mapping and if the mapping // is not the stack. If the mapping has no name, it is inconclusive whether @@ -550,10 +550,10 @@ bool ExploitabilityLinux::StackPointerOffStack(uint64_t stack_ptr) { } bool ExploitabilityLinux::ExecutableStackOrHeap() { - MinidumpLinuxMapsList *linux_maps_list = dump_->GetLinuxMapsList(); + MinidumpLinuxMapsList* linux_maps_list = dump_->GetLinuxMapsList(); if (linux_maps_list) { for (size_t i = 0; i < linux_maps_list->get_maps_count(); i++) { - const MinidumpLinuxMaps *linux_maps = + const MinidumpLinuxMaps* linux_maps = linux_maps_list->GetLinuxMapsAtIndex(i); // Check for executable stack or heap for each mapping. if (linux_maps && (!linux_maps->GetPathname().compare( @@ -574,15 +574,15 @@ bool ExploitabilityLinux::InstructionPointerInCode(uint64_t instruction_ptr) { // whether it is in a valid code region. If there is no mapping for the // instruction pointer, it is indicative that the instruction pointer is // not within a module, which implies that it is outside a valid area. - MinidumpLinuxMapsList *linux_maps_list = dump_->GetLinuxMapsList(); - const MinidumpLinuxMaps *linux_maps = + MinidumpLinuxMapsList* linux_maps_list = dump_->GetLinuxMapsList(); + const MinidumpLinuxMaps* linux_maps = linux_maps_list ? linux_maps_list->GetLinuxMapsForAddress(instruction_ptr) : NULL; return linux_maps ? linux_maps->IsExecutable() : false; } -bool ExploitabilityLinux::BenignCrashTrigger(const MDRawExceptionStream - *raw_exception_stream) { +bool ExploitabilityLinux::BenignCrashTrigger( + const MDRawExceptionStream* raw_exception_stream) { // Check the cause of crash. // If the exception of the crash is a benign exception, // it is probably not exploitable. -- cgit v1.2.1