]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Detect line number overflow in dwarf_getsrclines on 32bit.
authorMark Wielaard <mjw@redhat.com>
Wed, 6 May 2015 10:55:21 +0000 (12:55 +0200)
committerMark Wielaard <mjw@redhat.com>
Tue, 12 May 2015 14:44:04 +0000 (16:44 +0200)
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 <mjw@redhat.com>
libdw/ChangeLog
libdw/dwarf_getsrclines.c

index f5dfc8f77856b9398b8a670960ab40c66fe960a7..034db1175ea024857cbf617bc27f5b12b2db9878 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-06  Mark Wielaard  <mjw@redhat.com>
+
+       * dwarf_getsrclines.c (read_srclines): Use an int64_t to store and
+       check the line number.
+
 2015-05-05  Mark Wielaard  <mjw@redhat.com>
 
        * dwarf_getaranges.c (dwarf_getaranges): Check there is enough data
index 368f2fd8385c8e76cdbf4c8180ad88ef96111fc1..5c85fd4f7804af09c481f3cdba7fbad2c97f185d 100644 (file)
@@ -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;