Author: jhb
Date: Wed Sep 23 21:57:29 2020
New Revision: 366094
URL: https://svnweb.freebsd.org/changeset/base/366094

Log:
  MFC 365278: Don't assume objects in program sections have a size of a pointer.
  
  The size of the object at 'addr' is unknown and might be smaller than
  the size of a pointer (e.g. some x86 instructions are smaller than a
  pointer).  Instead, just check that the address is in the bounds of
  the program header.

Modified:
  stable/11/lib/libc/gen/elf_utils.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/lib/libc/gen/elf_utils.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/lib/libc/gen/elf_utils.c
==============================================================================
--- stable/11/lib/libc/gen/elf_utils.c  Wed Sep 23 19:54:59 2020        
(r366093)
+++ stable/11/lib/libc/gen/elf_utils.c  Wed Sep 23 21:57:29 2020        
(r366094)
@@ -50,7 +50,7 @@ __elf_phdr_match_addr(struct dl_phdr_info *phdr_info, 
                if (ph->p_type != PT_LOAD || (ph->p_flags & PF_X) == 0)
                        continue;
                if (phdr_info->dlpi_addr + ph->p_vaddr <= (uintptr_t)addr &&
-                   (uintptr_t)addr + sizeof(addr) < phdr_info->dlpi_addr +
+                   (uintptr_t)addr < phdr_info->dlpi_addr +
                    ph->p_vaddr + ph->p_memsz)
                        break;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to