src/file_wdp.c: improve Frama-C annotations

src/file_tiff.h: fix annotation
This commit is contained in:
Christophe Grenier 2021-07-27 21:21:12 +02:00
parent f7fee461b4
commit 1406dfe592
2 changed files with 9 additions and 12 deletions

View file

@ -101,11 +101,13 @@ unsigned int find_tag_from_tiff_header_le(const unsigned char *buffer, const uns
@ requires fr->file_check==&file_check_tiff_le; @ requires fr->file_check==&file_check_tiff_le;
@ requires valid_file_check_param(fr); @ requires valid_file_check_param(fr);
@ ensures valid_file_check_result(fr); @ ensures valid_file_check_result(fr);
@ assigns errno;
@ assigns fr->file_size;
@ assigns *fr->handle;
@ assigns Frama_C_entropy_source;
@*/ @*/
/*X FIXME: parse_strip_le calls MALLOC()
X assigns errno;
X assigns fr->file_size;
X assigns *fr->handle;
X assigns Frama_C_entropy_source;
X*/
void file_check_tiff_le(file_recovery_t *fr); void file_check_tiff_le(file_recovery_t *fr);
#endif #endif

View file

@ -33,9 +33,8 @@
#include "file_tiff.h" #include "file_tiff.h"
#include "common.h" #include "common.h"
/*@ requires \valid(file_stat); */ /*@ requires valid_register_header_check(file_stat); */
static void register_header_check_wdp(file_stat_t *file_stat); static void register_header_check_wdp(file_stat_t *file_stat);
static int header_check_wdp(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new);
const file_hint_t file_hint_wdp = { const file_hint_t file_hint_wdp = {
.extension = "wdp", .extension = "wdp",
@ -48,13 +47,9 @@ const file_hint_t file_hint_wdp = {
/*@ /*@
@ requires buffer_size >= sizeof(TIFFHeader); @ requires buffer_size >= sizeof(TIFFHeader);
@ requires \valid_read(buffer+(0..buffer_size-1));
@ requires valid_file_recovery(file_recovery);
@ requires \valid(file_recovery_new);
@ requires file_recovery_new->blocksize > 0;
@ requires separation: \separated(&file_hint_wdp, buffer+(..), file_recovery, file_recovery_new); @ requires separation: \separated(&file_hint_wdp, buffer+(..), file_recovery, file_recovery_new);
@ ensures \result == 0 || \result == 1; @ requires valid_header_check_param(buffer, buffer_size, safe_header_only, file_recovery, file_recovery_new);
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new); @ ensures valid_header_check_result(\result, file_recovery_new);
@ assigns *file_recovery_new; @ assigns *file_recovery_new;
@*/ @*/
static int header_check_wdp(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new) static int header_check_wdp(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)