src/file_ifo.c: add frama-c annotations
This commit is contained in:
parent
765c7be1a1
commit
33246b1542
1 changed files with 14 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "filegen.h"
|
||||
#include "common.h"
|
||||
|
||||
/*@ requires \valid(file_stat); */
|
||||
static void register_header_check_ifo(file_stat_t *file_stat);
|
||||
|
||||
const file_hint_t file_hint_ifo= {
|
||||
|
@ -50,6 +51,17 @@ struct ifo_hdr
|
|||
uint32_t ls_IFO;
|
||||
} __attribute__ ((gcc_struct, __packed__));
|
||||
|
||||
/*@
|
||||
@ requires buffer_size >= sizeof(struct ifo_hdr);
|
||||
@ 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_ifo, 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_ifo(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 struct ifo_hdr *hdr=(const struct ifo_hdr *)buffer;
|
||||
|
@ -66,6 +78,8 @@ static void register_header_check_ifo(file_stat_t *file_stat)
|
|||
static const unsigned char ifo_header_vmg[12]= { 'D', 'V', 'D', 'V', 'I', 'D', 'E', 'O', '-', 'V', 'M', 'G'};
|
||||
static const unsigned char ifo_header_vts[12]= { 'D', 'V', 'D', 'V', 'I', 'D', 'E', 'O', '-', 'V', 'T', 'S'};
|
||||
register_header_check(0, ifo_header_vmg, sizeof(ifo_header_vmg), &header_check_ifo, file_stat);
|
||||
#ifndef __FRAMAC__
|
||||
register_header_check(0, ifo_header_vts, sizeof(ifo_header_vts), &header_check_ifo, file_stat);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue