facebook / facebook/infer

fclose builtin not modeled as file resource

Ouverte
#556 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
c good first task help wanted
Langage dominant
OCaml
Étoiles
15.7k
Forks
2.1k
Merge moyen
19 h 36 min
PR mergées (30 j)
13

Description

I noticed that the resource predicate for `fclose` matches `Rmemory Mnew` instead of `Rfile` as expected (PredSymb.re). `fclose` is modeled as `free`, but no file attribute is set (compare https://github.com/facebook/infer/blob/master/infer/models/c/src/libc_basic.c#L485 and `fopen` https://github.com/facebook/infer/blob/master/infer/models/c/src/libc_basic.c#L445).

Is there a particular reason for this? If I set the file attribute for `fclose`, the OCaml type matches the `Rfile` that I expect. I.e.,

```
int fclose(FILE* stream) {
int n;
free(stream);
__set_file_attribute(stream);
n = __infer_nondet_int();
if (n > 0)
return 0;
else
return EOF;
}
```

Same question for the `close` model.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.