Page MenuHomePhabricator

Explicitly Cast Constants to DWORD
ClosedPublic

Authored by jmittert on Aug 19 2019, 3:05 PM.

Details

Summary

STATUS_SINGLE_STEP and STATUS_BREAKPOINT are defined as 0x8------ which
is negative and thus can't be implicitly narrowed to a DWORD which is
unsigned.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

jmittert created this revision.Aug 19 2019, 3:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2019, 3:05 PM
compnerd accepted this revision.Aug 19 2019, 3:38 PM
This revision is now accepted and ready to land.Aug 19 2019, 3:38 PM

Is this necessary? I see

C++
#define STATUS_BREAKPOINT                ((DWORD   )0x80000003L)
#define STATUS_SINGLE_STEP               ((DWORD   )0x80000004L)

in C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h

I believe it's using the one in ntstatus.h

10.0.16299.0\shared\ntstatus.h
#define STATUS_BREAKPOINT                ((NTSTATUS)0x80000003L)    // winnt

And NTSTATUS is defined as a LONG in powerbase.h

10.0.16299.0\um\powerbase.h
#define NTSTATUS LONG

which would make it a signed (negative) number.

compnerd closed this revision.Aug 23 2019, 10:57 AM

SVN r369788