Skip to content

stacker::grow Causes Invalid Memory Access #110

@AvivYossef-starkware

Description

@AvivYossef-starkware

The stucker::grow function appears to cause invalid memory access when the input stack_size is not divisible by the page size. This issue likely originates from a miscalculation in the following code snippet:

let page_size = page_size();
let requested_pages = stack_size
    .checked_add(page_size - 1)
    .expect("unreasonably large stack requested") / page_size;
let stack_pages = std::cmp::max(1, requested_pages) + 2;
let stack_bytes = stack_pages.checked_mul(page_size);

I have tested my code extensively with various stack_size values and observed that this issue occurs specifically when the input stack_size is not divisible by the page size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions