source: trunk/tools/mklibs/patches/005-readelf_fixes.patch @ 18083

Last change on this file since 18083 was 18083, checked in by nbd, 7 years ago

mklibs: fix crashes on nonexistant sections in readelf (thx, justus)

File size: 1.2 KB
  • src/mklibs-readelf/main.cpp

    a b static void process_elf_header (Elf::fil 
    5757static void process_dynamics (Elf::file *file, int64_t tag) 
    5858{ 
    5959  const Elf::section_type<Elf::section_type_DYNAMIC> *section = file->get_section_DYNAMIC (); 
     60 
     61  if (!section) 
     62    return; 
     63 
    6064  for (std::vector<Elf::dynamic *>::const_iterator it = section->get_dynamics ().begin (); it != section->get_dynamics ().end (); ++it) 
    6165  { 
    6266    Elf::dynamic *dynamic = *it; 
    static void process_dynamics (Elf::file  
    6771 
    6872static void process_symbols_provided (const Elf::section_type<Elf::section_type_DYNSYM> *section) 
    6973{ 
     74  if (!section) 
     75    return; 
     76 
    7077  for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it) 
    7178  { 
    7279    const Elf::symbol *symbol = *it; 
    static void process_symbols_provided (co 
    95102 
    96103static void process_symbols_undefined (const Elf::section_type<Elf::section_type_DYNSYM> *section) 
    97104{ 
     105  if (!section) 
     106    return; 
     107 
    98108  for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it) 
    99109  { 
    100110    const Elf::symbol *symbol = *it; 
Note: See TracBrowser for help on using the repository browser.