Skip to content

Failing to reassociate arithmetic causes out-of-bounds access #280

@davidchisnall

Description

@davidchisnall

This line:

                doublebasemul(r->coeffs + ctr - 4, b->coeffs + ctr - 4, ax, (ctr - 4) / 4, add);

Adds a counter to the pointer and then subtracts four. The array is quite small (four bytes) and so ctr takes it out of representable bounds and -4 brings it back in. If this were lowered as addi and then cincaddr, it would always be fine (and this should be sound: if the result is in representable bounds then this is fine, if the result isn't in the representable bounds then it doesn't matter that the intermediate bits are).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions