Skip to content

Commit

Permalink
replaces sizeof(raw_context) with sizeof(*raw_context)
Browse files Browse the repository at this point in the history
Using `sizeof(raw_context)` generates the following warning (which is
an error in ChromeOS):

```
'memset' call operates on objects of type 'MDRawContextX86' while the size
is based on a different type 'MDRawContextX86 *'
```

This commit follows the implied advice of this warning and adjusts the
expression.

Bug: b:238678030, b:243982778
Test: Locally
Change-Id: I26111c6ff7a1223223e6096a75ad52c48d941e89
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3960915
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
  • Loading branch information
cjdb authored and Joshua Peraza committed Oct 17, 2022
1 parent f9bf260 commit b90119e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/processor/disassembler_objdump_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class TestDumpContext : public DumpContext {
TestDumpContext::TestDumpContext(bool x86_64) {
if (!x86_64) {
MDRawContextX86* raw_context = new MDRawContextX86();
memset(raw_context, 0, sizeof(raw_context));
memset(raw_context, 0, sizeof(*raw_context));

raw_context->context_flags = MD_CONTEXT_X86_FULL;

Expand All @@ -170,7 +170,7 @@ TestDumpContext::TestDumpContext(bool x86_64) {
this->valid_ = true;
} else {
MDRawContextAMD64* raw_context = new MDRawContextAMD64();
memset(raw_context, 0, sizeof(raw_context));
memset(raw_context, 0, sizeof(*raw_context));

raw_context->context_flags = MD_CONTEXT_AMD64_FULL;

Expand Down Expand Up @@ -461,4 +461,4 @@ TEST(DisassemblerObjdumpTest, AMD64CallRegOffset) {
ASSERT_FALSE(dis.CalculateSrcAddress(context, src_address));
ASSERT_EQ(dest_address, kAMD64TestRsi + 0x9999999);
}
} // namespace google_breakpad
} // namespace google_breakpad

0 comments on commit b90119e

Please sign in to comment.