[Bug tools/23248] armv7l: dwarf_getsrclines.c:362:37: error: argument 1 value '4294967288' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]

mark at klomp dot org sourceware-bugzilla@sourceware.org
Wed May 30 12:23:00 GMT 2018


https://sourceware.org/bugzilla/show_bug.cgi?id=23248

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
ndirs is read from the debug data and should be size checked before use.
Does the following work for you?

diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c
index 2bf30984..c353e5b7 100644
--- a/libdw/dwarf_getsrclines.c
+++ b/libdw/dwarf_getsrclines.c
@@ -359,6 +359,8 @@ read_srclines (Dwarf *dbg,
   ndirlist = ndirs;
   if (ndirlist >= MAX_STACK_DIRS)
     {
+      if (ndirlist > SIZE_MAX / sizeof (*dirarray))
+       goto no_mem;
       dirarray = (struct dirlist *) malloc (ndirlist * sizeof (*dirarray));
       if (unlikely (dirarray == NULL))
        {

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Elfutils-devel mailing list