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

Issue 1570843002: libdisasm: Don't depend on sizeof(void) (Closed)

Created:
4 years, 11 months ago by labath
Modified:
4 years, 11 months ago
CC:
google-breakpad-dev_googlegroups.com
Base URL:
https://chromium.googlesource.com/breakpad/breakpad@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

libdisasm: Don't depend on sizeof(void) Due to operator precedence, the address was first cast to void* and then incremented, which resulted in an error on windows, as sizeof(void) is undefined and MSVC takes this seriously. Changing the precedence to perform the addition first. R=mark@chromium.org Committed: https://chromium.googlesource.com/breakpad/breakpad/+/104784d8e42a22acadbfa69a55a7f3e0510f8a61

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -3 lines) Patch
M src/third_party/libdisasm/x86_disasm.c View 2 chunks +3 lines, -3 lines 1 comment Download

Messages

Total messages: 10 (4 generated)
labath
4 years, 11 months ago (2016-01-08 16:16:06 UTC) #2
Mark Mentovai
LGTM
4 years, 11 months ago (2016-01-08 17:51:30 UTC) #4
Mark Mentovai
Committed patchset #1 (id:1) manually as 104784d8e42a22acadbfa69a55a7f3e0510f8a61 (presubmit successful).
4 years, 11 months ago (2016-01-08 17:52:08 UTC) #6
brucedawson
https://codereview.chromium.org/1570843002/diff/1/src/third_party/libdisasm/x86_disasm.c File src/third_party/libdisasm/x86_disasm.c (right): https://codereview.chromium.org/1570843002/diff/1/src/third_party/libdisasm/x86_disasm.c#newcode38 src/third_party/libdisasm/x86_disasm.c:38: x86_report_error(report_disasm_bounds, (void*)(long)(buf_rva+offset)); Too late for this change, but why ...
4 years, 11 months ago (2016-01-08 21:19:11 UTC) #8
labath
I agree that the casts look strange, and the long part can probably be removed. ...
4 years, 11 months ago (2016-01-11 13:23:02 UTC) #9
brucedawson
4 years, 11 months ago (2016-01-11 18:10:53 UTC) #10
Message was sent while issue was closed.
On 2016/01/11 13:23:02, labath wrote:
> I agree that the casts look strange, and the long part can probably be
removed.
> I didn't want to do that as I am new to this code, but I can create a separate
> cl if you think it's needed.

The code is confusing, but not currently harmful. Since both buf_rva and offset
are 32-bit values there is no harm in casting them to long, it's just... odd. It
also might trigger warnings when compiling in 64-bit mode, especially with VC++
2015. But, I don't see any compelling need for refactoring so "leave well enough
alone" may apply.

Powered by Google App Engine
This is Rietveld 408576698