Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
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
Ettayeb Yassine
AnaStat-Frama-C-24-25
Commits
cbcf0ff2
Commit
cbcf0ff2
authored
2 weeks ago
by
Ettayeb Yassine
Browse files
Options
Downloads
Patches
Plain Diff
cwe done
parent
ee61bca1
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
Compte_rendu_Yassine_Ettayeb.docx
+0
-0
0 additions, 0 deletions
Compte_rendu_Yassine_Ettayeb.docx
config/cert_exp_33_realloc.c
+18
-15
18 additions, 15 deletions
config/cert_exp_33_realloc.c
config/cwe20.c
+21
-0
21 additions, 0 deletions
config/cwe20.c
with
39 additions
and
15 deletions
Compte_rendu_Yassine_Ettayeb.docx
0 → 100644
+
0
−
0
View file @
cbcf0ff2
File added
This diff is collapsed.
Click to expand it.
config/cert_exp_33_realloc.c
+
18
−
15
View file @
cbcf0ff2
#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
));
//@ split ret==0;
int
*
ret
=
(
int
*
)
realloc
(
array
,
new_
count
*
sizeof
(
int
));
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
;
Frama_C_show_each_init_array
(
array
[
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
]);
}
...
...
This diff is collapsed.
Click to expand it.
config/cwe20.c
+
21
−
0
View file @
cbcf0ff2
#include
<stdio.h>
#include
<stdlib.h>
#include
<stddef.h>
void
die
(
const
char
*
s
)
{
printf
(
"%s"
,
s
);
exit
(
2
);
...
...
@@ -24,10 +27,28 @@ int main () {
if
(
EOF
==
error
){
die
(
"No integer passed: Die evil hacker!
\n
"
);
}
// Vérification des dimensions pour éviter des erreurs de mémoire
if
(
m
<=
0
||
n
<=
0
||
m
>
MAX_DIM
||
n
>
MAX_DIM
)
{
die
(
"Invalid board size: Die evil hacker!
\n
"
);
}
if
(
m
>
MAX_DIM
||
n
>
MAX_DIM
)
{
die
(
"Value too large: Die evil hacker!
\n
"
);
}
//@ split m;
//@ split n;
board
=
(
board_square_t
*
)
malloc
(
m
*
n
*
sizeof
(
board_square_t
));
// Vérification si malloc a échoué
if
(
!
board
)
{
return
2
;
}
//@ split m;
//@ split n;
for
(
int
i
=
0
;
i
<
m
;
i
++
)
{
for
(
int
j
=
0
;
j
<
n
;
j
++
)
{
board
[
n
*
i
+
j
]
=
0
;
...
...
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