Fix stack memory, undefined behavior, etc.

This commit is contained in:
Justine Tunney 2023-08-15 19:09:35 -07:00
parent 110559ce6a
commit 507d7a0b0b
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
11 changed files with 41 additions and 186 deletions

View file

@ -49,7 +49,7 @@ int(_bsrl)(long x) {
x |= x >> 8;
x |= x >> 16;
x |= x >> 32;
return kDebruijn[(x * 0x03f79d71b4cb0a89) >> 58];
return kDebruijn[(x * 0x03f79d71b4cb0a89ull) >> 58];
}
__weak_reference(_bsrl, _bsrll);

View file

@ -54,7 +54,7 @@ static const char *GetFrameName(int x) {
x <= ((GetStaticStackAddr(0) + GetStackSize() +
sizeof(struct WinArgs) - 1) >>
16))) {
return "winargs";
return "mainstack";
} else if ((int)((intptr_t)__executable_start >> 16) <= x &&
x <= (int)(((intptr_t)_end - 1) >> 16)) {
return "image";