Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pub
frama-c
Commits
3f781f50
Commit
3f781f50
authored
4 years ago
by
Basile Desloges
Browse files
Options
Downloads
Patches
Plain Diff
[eacsl] Check assumption in get_stack_start
parent
b4636e57
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c
+16
-2
16 additions, 2 deletions
...sl/observation_model/segment_model/e_acsl_shadow_layout.c
with
16 additions
and
2 deletions
src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c
+
16
−
2
View file @
3f781f50
...
...
@@ -79,8 +79,8 @@ extern char ** environ;
/*! \brief Return the greatest (known) address on a program's stack.
* This function presently determines the address using the address of the
* last string in `environ`. That is, it assumes that argc and argv are
* stored below environ, which holds for GCC
/
Glibc but is not
necessarily
* true for some other compilers/libraries. */
* stored below environ, which holds for GCC
or Clang and
Glibc but is not
*
necessarily
true for some other compilers/libraries. */
static
uintptr_t
get_stack_start
(
int
*
argc_ref
,
char
***
argv_ref
)
{
char
**
env
=
environ
;
while
(
env
[
1
])
...
...
@@ -94,6 +94,20 @@ static uintptr_t get_stack_start(int *argc_ref, char *** argv_ref) {
* ::argv_alloca. */
uintptr_t
stack_end
=
addr
+
ULONG_BITS
;
uintptr_t
stack_start
=
stack_end
-
get_stack_size
();
// Check that the assumption that argc and argv are stored below environ in
// the stack holds
DVASSERT
(
stack_start
<=
(
uintptr_t
)
argc_ref
&&
(
uintptr_t
)
argc_ref
<=
stack_end
,
"Assumption that argc is stored below environ is not verified.
\n
\
\t
Stack: [%a - %a]
\n\t
&argc: %a"
,
stack_start
,
stack_end
,
argc_ref
);
DVASSERT
(
stack_start
<=
(
uintptr_t
)
argv_ref
&&
(
uintptr_t
)
argv_ref
<=
stack_end
,
"Assumption that argv is stored below environ is not verified.
\n
\
\t
Stack: [%a - %a]
\n\t
&argc: %a"
,
stack_start
,
stack_end
,
argc_ref
);
return
stack_start
;
}
/* }}} */
...
...
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