src/file_r3d.c: improve Frama-C annotations
This commit is contained in:
parent
260c40183b
commit
a723179662
1 changed files with 9 additions and 21 deletions
|
@ -34,7 +34,7 @@
|
|||
#include "common.h"
|
||||
#include "log.h"
|
||||
|
||||
/*@ requires \valid(file_stat); */
|
||||
/*@ requires valid_register_header_check(file_stat); */
|
||||
static void register_header_check_r3d(file_stat_t *file_stat);
|
||||
|
||||
const file_hint_t file_hint_r3d = {
|
||||
|
@ -53,13 +53,9 @@ struct atom_struct
|
|||
} __attribute__((gcc_struct, __packed__));
|
||||
|
||||
/*@
|
||||
@ requires buffer_size > 0;
|
||||
@ requires (buffer_size&1)==0;
|
||||
@ requires \valid_read(buffer+(0..buffer_size-1));
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires file_recovery->data_check==&data_check_r3d;
|
||||
@ requires \separated(buffer + (..), file_recovery);
|
||||
@ ensures \result == DC_CONTINUE || \result == DC_STOP;
|
||||
@ requires valid_data_check_param(buffer, buffer_size, file_recovery);
|
||||
@ ensures valid_data_check_result(\result, file_recovery);
|
||||
@ assigns file_recovery->calculated_file_size, file_recovery->data_check;
|
||||
@*/
|
||||
static data_check_t data_check_r3d(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
|
||||
|
@ -105,9 +101,9 @@ static data_check_t data_check_r3d(const unsigned char *buffer, const unsigned i
|
|||
}
|
||||
|
||||
/*@
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires valid_file_recovery(file_recovery);
|
||||
@ requires file_recovery->file_rename==&file_rename_r3d;
|
||||
@ requires valid_file_rename_param(file_recovery);
|
||||
@ ensures valid_file_rename_result(file_recovery);
|
||||
@*/
|
||||
static void file_rename_r3d(file_recovery_t *file_recovery)
|
||||
{
|
||||
|
@ -132,13 +128,9 @@ static void file_rename_r3d(file_recovery_t *file_recovery)
|
|||
|
||||
/*@
|
||||
@ requires buffer_size >= sizeof(struct atom_struct);
|
||||
@ 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_r3d, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
||||
@ requires valid_header_check_param(buffer, buffer_size, safe_header_only, file_recovery, file_recovery_new);
|
||||
@ ensures valid_header_check_result(\result, file_recovery_new);
|
||||
@ assigns *file_recovery_new;
|
||||
@*/
|
||||
static int header_check_r3d(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)
|
||||
|
@ -162,13 +154,9 @@ static int header_check_r3d(const unsigned char *buffer, const unsigned int buff
|
|||
|
||||
/*@
|
||||
@ requires buffer_size >= 0xc;
|
||||
@ 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_r3d, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
||||
@ requires valid_header_check_param(buffer, buffer_size, safe_header_only, file_recovery, file_recovery_new);
|
||||
@ ensures valid_header_check_result(\result, file_recovery_new);
|
||||
@ assigns *file_recovery_new;
|
||||
@*/
|
||||
static int header_check_r3d_v2(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)
|
||||
|
|
Loading…
Reference in a new issue