Skip to content

need to check lower bound on index in rw_range_sett::get_objects_byte_extract #2822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion regression/cbmc/full_slice3/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.c
--full-slice
^EXIT=0$
Expand Down
11 changes: 9 additions & 2 deletions src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,15 @@ void rw_range_sett::get_objects_byte_extract(
be.op().type(),
be.id()==ID_byte_extract_little_endian,
ns);
range_spect offset =
range_start + map.map_bit(numeric_cast_v<std::size_t>(*index));
range_spect offset = range_start;
if(*index > 0)
offset += map.map_bit(numeric_cast_v<std::size_t>(*index));
else
{
// outside the bounds of immediate byte-extract operand, might still be in
// bounds of a parent object
offset += to_range_spect(*index);
}
get_objects_rec(mode, be.op(), offset, size);
}
}
Expand Down