SHA256
1
0
forked from pool/ptools
ptools/commit-a42a099
Dirk Mueller 83052cee5a - Added fix-32bit-cast.diff which replaces a cast which is OK for
64bit targets but not for 32 bit targets to make the package
  buildable with GCC 14 on i586.

If the request is OK, please forward it to Factory too so that we can
switch the default compiler soon.  Thanks!

OBS-URL: https://build.opensuse.org/package/show/Base:System/ptools?expand=0&rev=14
2024-08-12 15:47:41 +00:00

34 lines
1.0 KiB
Plaintext

commit a42a0991797ab10c04bbcdf7cc2846c5da5bbd25
Author: Jan Blunck <jblunck@suse.de>
Date: Mon Sep 21 17:57:02 2009 +0200
Fix crash in map_seach_ehdr()
When searching for the ELF header check if libelf returned a valid pointer
before referencing it.
https://crashdb.opensuse.org/log/show/b75d1730f4c944b092afd8f302fe76b7
Signed-off-by: Jan Blunck <jblunck@suse.de>
---
src/pbuildid.c | 5 +++++
1 file changed, 5 insertions(+)
Index: b/src/pbuildid.c
===================================================================
--- a/src/pbuildid.c
+++ b/src/pbuildid.c
@@ -467,6 +467,11 @@ static Elf *map_search_ehdr(struct core_
/* Look for ELF header in this LOAD segment */
data = elf_getdata_rawchunk (map->elf, map->p_offset,
map->p_filesz, ELF_T_EHDR);
+ if (!data) {
+ fprintf(stderr, "Couldn't read LOAD segment: %s\n",
+ elf_errmsg(-1));
+ return NULL;
+ }
e_ident = (unsigned char *)data->d_buf;
if (memcmp (e_ident, ELFMAG, SELFMAG) != 0
|| e_ident[EI_CLASS] <= ELFCLASSNONE