We do check whether the values we store for the line fit our data representation in add_new_line, but on 32bit systems we would fail to notice line overflowing.
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c32 Signed-off-by: Mark Wielaard <[email protected]> --- libdw/ChangeLog | 5 +++++ libdw/dwarf_getsrclines.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index f5dfc8f..034db11 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2015-05-06 Mark Wielaard <[email protected]> + + * dwarf_getsrclines.c (read_srclines): Use an int64_t to store and + check the line number. + 2015-05-05 Mark Wielaard <[email protected]> * dwarf_getaranges.c (dwarf_getaranges): Check there is enough data diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c index 368f2fd..5c85fd4 100644 --- a/libdw/dwarf_getsrclines.c +++ b/libdw/dwarf_getsrclines.c @@ -302,7 +302,8 @@ read_srclines (Dwarf *dbg, Dwarf_Word addr = 0; unsigned int op_index = 0; unsigned int file = 1; - int line = 1; + /* We only store an int, but want to check for overflow (see SET below). */ + int64_t line = 1; unsigned int column = 0; uint_fast8_t is_stmt = default_is_stmt; bool basic_block = false; -- 2.1.0
