Skip to content

Check number of arguments for shims #1272

Closed
@RalfJung

Description

@RalfJung

Basically all our shims look something like this:

                let _attr_place = this.deref_operand(args[0])?;
                let addr_place = this.deref_operand(args[1])?;
                let size_place = this.deref_operand(args[2])?;

This code will ICE if the user passes fewer than 3 arguments, and it will silently "just work" if the user passes more than 3 arguments. To mitigate this, I propose we add a helper function check_arg_count or so that we call for each and every shim (foreign items and intrinsics) to raise an appropriate error (UB seems right) in case the number of arguments is wrong.

(libstd-only shims that check this.frame().instance do not need checking.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-shimsArea: This affects the external function shimsC-bugCategory: This is a bug.E-good-first-issueA good way to start contributing, mentoring is availableI-ICEImpact: makes Miri crash with some ICEI-misses-UBImpact: makes Miri miss UB, i.e., a false negative (with default settings)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions