diff --git a/src/file_mov.c b/src/file_mov.c index f956918d..8568fc92 100644 --- a/src/file_mov.c +++ b/src/file_mov.c @@ -37,9 +37,9 @@ #include "__fc_builtin.h" #endif -/*@ requires \valid(file_stat); */ +/*@ requires valid_register_header_check(file_stat); */ static void register_header_check_mov(file_stat_t *file_stat); -/*@ requires \valid(file_stat); */ +/*@ requires valid_register_header_check(file_stat); */ static void register_header_check_mov_mdat(file_stat_t *file_stat); const file_hint_t file_hint_mov= { @@ -82,9 +82,9 @@ struct atom64_struct } __attribute__ ((gcc_struct, __packed__)); /*@ - @ requires \valid(file_recovery); - @ requires valid_file_recovery(file_recovery); @ requires file_recovery->file_rename == &file_rename_mov; + @ requires valid_file_rename_param(file_recovery); + @ ensures valid_file_rename_result(file_recovery); @*/ static void file_rename_mov(file_recovery_t *file_recovery) { @@ -135,12 +135,9 @@ static inline int is_known_atom(const unsigned char *atom) /*@ @ requires buffer_size >= 16; - @ requires (buffer_size&1)==0; - @ requires \valid_read(buffer+(0..buffer_size-1)); - @ requires \valid(file_recovery); @ requires file_recovery->data_check==&data_check_mov; - @ 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; @*/ static data_check_t data_check_mov(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery) @@ -219,13 +216,9 @@ static data_check_t data_check_mov(const unsigned char *buffer, const unsigned i /*@ @ requires buffer_size >= 16; - @ requires \valid_read(buffer+(0..buffer_size-1)); - @ requires \valid_read(file_recovery); - @ requires file_recovery->file_stat==\null || valid_read_string((char*)file_recovery->filename); - @ requires \valid(file_recovery_new); - @ requires file_recovery_new->blocksize > 0; @ requires separation: \separated(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 valid_header_check_result(\result, file_recovery_new); @ ensures (\result == 1) ==> (file_recovery_new->file_stat == \null); @ ensures (\result == 1) ==> (file_recovery_new->handle == \null); @ ensures (\result == 1) ==> (file_recovery_new->extension == file_hint_mov.extension || @@ -244,7 +237,6 @@ static data_check_t data_check_mov(const unsigned char *buffer, const unsigned i @ ensures (\result == 1 && (file_recovery_new->extension == extension_jp2 || file_recovery_new->blocksize < 16)) ==> (file_recovery_new->data_check == \null && file_recovery_new->file_check == \null && file_recovery_new->file_rename == \null && file_recovery_new->min_filesize > 0); @ ensures (\result == 1 && file_recovery_new->extension != extension_jp2 && file_recovery_new->blocksize >= 16) ==> (file_recovery_new->calculated_file_size > 0 && file_recovery_new->file_check == &file_check_size && file_recovery_new->data_check == &data_check_mov); @ ensures (\result == 1) ==> \separated(file_recovery_new, file_recovery_new->extension); - @ ensures \result!=0 ==> valid_file_recovery(file_recovery_new); @*/ static int header_check_mov_aux(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) { @@ -486,12 +478,9 @@ static int header_check_mov_aux(const unsigned char *buffer, const unsigned int /*@ @ requires buffer_size >= 16; - @ requires \valid_read(buffer+(0..buffer_size-1)); - @ requires \valid_read(file_recovery); - @ requires \valid(file_recovery_new); - @ requires file_recovery_new->blocksize > 0; @ requires separation: \separated(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 valid_header_check_result(\result, file_recovery_new); @ ensures (\result == 1) ==> (file_recovery_new->extension == file_hint_mov.extension || file_recovery_new->extension == extension_3g2 || file_recovery_new->extension == extension_3gp || @@ -506,7 +495,6 @@ static int header_check_mov_aux(const unsigned char *buffer, const unsigned int @ ensures (\result == 1 && file_recovery_new->extension != file_hint_mov.extension) ==> (file_recovery_new->file_rename == \null); @ ensures (\result == 1 && (file_recovery_new->extension == extension_jp2 || file_recovery_new->blocksize < 16)) ==> (file_recovery_new->data_check == \null && file_recovery_new->file_check == \null && file_recovery_new->file_rename == \null && file_recovery_new->min_filesize > 0); @ ensures (\result == 1 && file_recovery_new->extension != extension_jp2 && file_recovery_new->blocksize >= 16) ==> (file_recovery_new->calculated_file_size > 0 && file_recovery_new->file_check == &file_check_size && file_recovery_new->data_check == &data_check_mov); - @ ensures \result!=0 ==> valid_file_recovery(file_recovery_new); @*/ static int header_check_mov(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) { @@ -522,7 +510,7 @@ static int header_check_mov(const unsigned char *buffer, const unsigned int buff } /*@ - @ requires \valid(file_stat); + @ requires valid_register_header_check(file_stat); @*/ static void register_header_check_mov_mdat(file_stat_t *file_stat) { @@ -530,7 +518,7 @@ static void register_header_check_mov_mdat(file_stat_t *file_stat) } /*@ - @ requires \valid(file_stat); + @ requires valid_register_header_check(file_stat); @*/ static void register_header_check_mov(file_stat_t *file_stat) {