Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Norodom-AnaStat-Frama-C-24-25
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Norodom Thomas
Norodom-AnaStat-Frama-C-24-25
Commits
1fc06aae
Commit
1fc06aae
authored
1 month ago
by
Norodom Thomas
Browse files
Options
Downloads
Patches
Plain Diff
partie realloc
parent
a28e6dbe
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/cert_exp_33.c
+0
-3
0 additions, 3 deletions
config/cert_exp_33.c
config/cert_exp_33_realloc.c
+19
-13
19 additions, 13 deletions
config/cert_exp_33_realloc.c
rapport.docx
+17
-0
17 additions, 0 deletions
rapport.docx
with
36 additions
and
16 deletions
config/cert_exp_33.c
+
0
−
3
View file @
1fc06aae
...
...
@@ -16,9 +16,6 @@ void set_flag(int number, int *sign_flag)
{
*
sign_flag
=
-
1
;
}
else
{
*
sign_flag
=
0
;
}
Frama_C_show_each_set_flag
(
number
,
*
sign_flag
);
}
...
...
This diff is collapsed.
Click to expand it.
config/cert_exp_33_realloc.c
+
19
−
13
View file @
1fc06aae
#include
<stdlib.h>
#include
<stdio.h>
#include
<string.h>
enum
{
OLD_SIZE
=
10
,
NEW_SIZE
=
20
};
int
*
resize_array
(
int
*
array
,
size_t
count
)
{
if
(
0
==
count
)
{
int
*
resize_array
(
int
*
array
,
size_t
old_count
,
size_t
new_
count
)
{
if
(
0
==
new_
count
)
{
return
0
;
}
int
*
ret
=
(
int
*
)
realloc
(
array
,
count
*
sizeof
(
int
));
int
*
ret
=
(
int
*
)
realloc
(
array
,
new_
count
*
sizeof
(
int
));
//@ split ret==0;
if
(
!
ret
)
{
free
(
array
);
return
0
;
}
if
(
new_count
>
old_count
)
{
memset
(
ret
+
old_count
,
0
,
(
new_count
-
old_count
)
*
sizeof
(
int
));
}
return
ret
;
}
void
func
(
void
)
{
int
*
array
=
(
int
*
)
malloc
(
OLD_SIZE
*
sizeof
(
int
));
if
(
0
==
array
)
{
/* Handle error */
return
;
}
for
(
size_t
i
=
0
;
i
<
OLD_SIZE
;
++
i
)
{
array
[
i
]
=
i
;
}
array
=
resize_array
(
array
,
NEW_SIZE
);
array
=
resize_array
(
array
,
OLD_SIZE
,
NEW_SIZE
);
if
(
0
==
array
)
{
/* Handle error */
return
;
}
for
(
size_t
i
=
0
;
i
<
NEW_SIZE
;
++
i
)
{
printf
(
"%d "
,
array
[
i
]);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
rapport.docx
0 → 100644
+
17
−
0
View file @
1fc06aae
J'ai eu quelques soucis liés à l'absence du include en début de code
sign peut être non-initialisé si number = 0
avec partition history, eva sépare les cas de number en positif, nul et négatif
red alarm quand partiion-history > 2
avec interprocedural history, la console spammme, attention à bien avoir le include time
correction de set_flag : remplacer > par >=
**Realloc**
Point d'entrée choisi : func
Red Alarm quand -eva-slevel = 10
Problème : le code corrigé fait apparaitre de nouvelles erreurs et mêmes de nouvelles alarmes rouges
Corrigé en ajoutant les return dans la version corrigée du code
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment