Escapes via `memcpy` are ignored

Open
#2,103 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
c, ocaml
Domain
devtools

Research direction

Start by running Goblint on the C reproducer with the shown analysis parameters, then trace the memcpy and modify path that leads to the Apron.Manager.Error. Done means this case is handled without the reported crash and the final __goblint_check result is produced.

Written by the indexing model from the issue text.

Description

unsound

For what it's worth, I tried to prompt AI to poke holes in the code for counterexamples in #2100, and (before the session got derailed by cybersecurity guardrails) it got me the following adjacent case:

// PARAM: --set ana.activated[+] apron --enable ana.sv-comp.functions
#include <goblint.h>
#include <string.h>

static int *target;

static void modify(void) {
  *target = __VERIFIER_nondet_int();
}

int main(void) {
  int left = __VERIFIER_nondet_int();
  int right = left;
  int *source = &right;
  memcpy(&target, &source, sizeof(target));

  modify();
  __goblint_check(left == right); // UNKNOWN!
}

which crashes Goblint with

Fatal error: exception Apron.Manager.Error
 {  exn = Exc_invalid_argument; funid = Funid_assign_texpr_array;
  msg = unknown variable right#671 in the environment; }

Given that the failure is different from the original one, I am approving this pull request.

Originally posted by @jprotopopov-ut in https://github.com/goblint/analyzer/issues/2100#issuecomment-5292729594

Dominant language
OCaml
Stars
252
Forks
90
Avg merge
4d 1m
Merged PRs (30d)
19

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from goblint/analyzer

All issues in goblint/analyzer

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.