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
affa390d
Commit
affa390d
authored
4 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] Builtins string: fixes a crash on offsetmap ranges smaller than characters.
parent
02b336ef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/value/domains/cvalue/builtins_string.ml
+16
-15
16 additions, 15 deletions
src/plugins/value/domains/cvalue/builtins_string.ml
with
16 additions
and
15 deletions
src/plugins/value/domains/cvalue/builtins_string.ml
+
16
−
15
View file @
affa390d
...
...
@@ -199,22 +199,23 @@ let fold_offsm kind ~validity ~start ~max offsetmap acc =
let
process_range
(
start
,
max
)
(
v
,
v_size
,
v_shift
)
acc
=
if
acc
.
stop
then
acc
else
let
min
=
Integer
.
round_up_to_r
~
min
:
start
~
r
:
Integer
.
zero
~
modu
in
if
Integer
.
gt
min
max
then
acc
else
let
v_start
=
Abstract_interp
.
Rel
.
add_abs
start
v_shift
in
(* Only one read of the value is needed when:
- the ending cut is aligned with the reads, meaning that no read
overlaps between two ranges of the offsetmap.
- and either the value is isotropic, or the repeated value has the
same size than the reads. *)
if
Integer
.
is_zero
(
Integer
.
e_rem
(
Integer
.
succ
max
)
modu
)
&&
(
Cvalue
.
V_Or_Uninitialized
.
is_isotropic
v
||
Integer
.
equal
min
v_start
&&
Integer
.
equal
v_size
kind
.
size
)
then
let
offset
=
make_interval
~
min
~
max
~
rem
:
Integer
.
zero
~
modu
in
read_char
kind
offset
v
acc
else
(* Otherwise, search the range by reading the offsetmap for each
required offset. Less efficient, but equally precise. *)
search_offsetmap_range
kind
offsetmap
validity
~
min
~
max
~
v_size
acc
(* Only one read of the value is needed when:
- the ending cut is aligned with the reads, meaning that no read
overlaps between two ranges of the offsetmap.
- and either the value is isotropic, or the repeated value has the
same size than the reads. *)
if
Integer
.
is_zero
(
Integer
.
e_rem
(
Integer
.
succ
max
)
modu
)
&&
(
Cvalue
.
V_Or_Uninitialized
.
is_isotropic
v
||
Integer
.
equal
min
v_start
&&
Integer
.
equal
v_size
kind
.
size
)
then
let
offset
=
make_interval
~
min
~
max
~
rem
:
Integer
.
zero
~
modu
in
read_char
kind
offset
v
acc
else
(* Otherwise, search the range by reading the offsetmap for each
required offset. Less efficient, but equally precise. *)
search_offsetmap_range
kind
offsetmap
validity
~
min
~
max
~
v_size
acc
in
Cvalue
.
V_Offsetmap
.
fold_between
~
entire
:
false
(
start
,
max
)
process_range
offsetmap
acc
...
...
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