Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #16176 : Making writeStackCookie() to use HEAPU32 #16433

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rajkumarananthu
Copy link

Made the makeSetValue() function to accept unsigned as a bool parameter,
and based on this bool value decide the type of HEAP(HEAP32/HEAPU32).

Made the makeSetValue() function to accept unsigned as a bool parameter,
and based on this bool value decide the type of HEAP(HEAP32/HEAPU32).
* @param {bool} ignore: legacy, ignored.
* @param {number} align: TODO
* @param {bool} noSafe: TODO
* @param {string} sep: TODO
* @param {bool} forcedAlign: legacy, ignored.
* @return {TODO}
*/
function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, sep = ';', forcedAlign) {
function makeSetValue(ptr, pos, value, type, noNeedFirst, unsigned, ignore, align, noSafe, sep = ';', forcedAlign) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new argument in this position will bread existing callers.

I'd rather not add complexity to makeSetValue by adding another argument here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also I'm curious why this was never needed before... how is it that all of the makeSetValue calls works just fine without ever using the unsigned heaps..).

{{{ makeSetValue('max', 0, '0x2135467', 'i32' ) }}};
{{{ makeSetValue('max', 4, '0x89BACDFE', 'i32' ) }}};
{{{ makeSetValue('max', 0, '0x2135467', 'i32', 0, true) }}};
{{{ makeSetValue('max', 4, '0x89BACDFE', 'i32', 0, true) }}};
Copy link
Collaborator

@sbc100 sbc100 Mar 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about instead we just change these lines to:

HEAPU32[(max >> 2)] = 0x2135467
HEAPU32[(max >> 2) + 1] = 0x89BACDFE

(also the line below would need updating too).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even better you can do:

var max = _emscripten_stack_get_end() >> 2;
HEAPU32[max] = 0x2135467;
HEAPU32[max + 1] = 0x89BACDFE;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants