src/file_pst.c: add Frama-C annotations
This commit is contained in:
parent
3a509008c6
commit
3906830e4a
1 changed files with 35 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "filegen.h"
|
||||
|
||||
|
||||
/*@ requires \valid(file_stat); */
|
||||
static void register_header_check_pst(file_stat_t *file_stat);
|
||||
static int header_check_pst(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);
|
||||
|
||||
|
@ -49,6 +50,17 @@ const file_hint_t file_hint_pst= {
|
|||
#define FILE_SIZE_POINTER_64 0xB8
|
||||
#define DBX_SIZE_POINTER 0x7C
|
||||
|
||||
/*@
|
||||
@ requires buffer_size >= DBX_SIZE_POINTER + 4;
|
||||
@ 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_pst, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
||||
@ assigns *file_recovery_new;
|
||||
@*/
|
||||
static int header_check_dbx(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 uint64_t size=(uint64_t)buffer[DBX_SIZE_POINTER] +
|
||||
|
@ -90,6 +102,17 @@ static int header_check_dbx(const unsigned char *buffer, const unsigned int buff
|
|||
http://www.five-ten-sg.com/libpst/
|
||||
*/
|
||||
|
||||
/*@
|
||||
@ requires buffer_size > 0;
|
||||
@ 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_pst, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
||||
@ assigns *file_recovery_new;
|
||||
@*/
|
||||
static int header_check_wab(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)
|
||||
{
|
||||
reset_file_recovery(file_recovery_new);
|
||||
|
@ -97,6 +120,18 @@ static int header_check_wab(const unsigned char *buffer, const unsigned int buff
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*@
|
||||
@ requires buffer_size >= FILE_SIZE_POINTER + 4;
|
||||
@ requires buffer_size >= FILE_SIZE_POINTER_64 + 8;
|
||||
@ 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_pst, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
||||
@ assigns *file_recovery_new;
|
||||
@*/
|
||||
static int header_check_pst(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)
|
||||
{
|
||||
if(buffer[INDEX_TYPE_OFFSET]==0x0e ||
|
||||
|
|
Loading…
Reference in a new issue