From dedb5e738826b51f12e0a216fad6be3b60668995 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 6 May 2015 12:55:21 +0200 Subject: [PATCH] libdw: Detect line number overflow in dwarf_getsrclines on 32bit. 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 --- libdw/ChangeLog | 5 +++++ libdw/dwarf_getsrclines.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index f5dfc8f77..034db1175 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2015-05-06 Mark Wielaard + + * dwarf_getsrclines.c (read_srclines): Use an int64_t to store and + check the line number. + 2015-05-05 Mark Wielaard * dwarf_getaranges.c (dwarf_getaranges): Check there is enough data diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c index 368f2fd83..5c85fd4f7 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.39.5