Skip to content

index out of bounds exceptions don't assume(false) #1349

Closed

Description

@tedinski

This is apparent in the docs/src/tutorials/loops-unwinding example. Where we get both a bounds and a pointer failure:

SUMMARY: 
 ** 2 of 350 failed
Failed Checks: index out of bounds: the length is less than or equal to the given index
 File: "./src/bounds_check.rs", line 11, in bounds_check::get_wrapped
Failed Checks: dereference failure: pointer outside object bounds
 File: "./src/bounds_check.rs", line 11, in bounds_check::get_wrapped

VERIFICATION:- FAILED

gen-c shows:

/* [KANI_REACHABILITY_CHECK] KANI_CHECK_ID_loops_unwinding.6ff84bc3::loops_unwinding_0 */
    assert(!1);
    if(var_18 == 0)
    {
      /* [KANI_CHECK_ID_loops_unwinding.6ff84bc3::loops_unwinding_0] index out of bounds: the length is less than or equal to the given index */
      assert(0);
      goto bb8;
    /* unreachable code */
    }


  bb8:
    ;

in contrast a typical assert shows:

      assert(0);
      __CPROVER_assume(0);

The result is confusing, since it seems to imply the bounds check isn't good enough and could still causing memory unsafety.

Activity

  1. added
    [C] Bug
    on Jul 7, 2022
  2. tedinski commented on Jul 7, 2022

    @tedinski
    ContributorAuthor

    This is probably a concrete example of #1056 needing to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions