On Wed, Mar 26, 2025 at 10:59:58PM +0900, Adam Rice wrote:
> Package: ltrace
> Version: 0.7.3+git20240814-0.3
> Severity: normal
> Tags: upstream
> X-Debbugs-Cc: [email protected]
> 
> Sample output:
> """
> ===> Building in /tmp/tmp.oldWtch6po ...
> ===> Running ltrace -p 4025257 ...
> Can't open /tmp/tmp.oldWtch6po/liblib.so: No such file or directory
> Couldn't determine base address of /tmp/tmp.oldWtch6po/liblib.so
> ltrace: ltrace-elf.c:426: ltelf_destroy: Assertion 
> `(&lte->plt_relocs)->elt_size == sizeof(GElf_Rela)' failed.
> """
Funnily enough, this is the last line in
  void
  ltelf_destroy(struct ltelf *lte)
  {
        debug(DEBUG_FUNCTION, "close_elf()");
        elf_end(lte->elf);
        close(lte->fd);
        VECT_DESTROY(&lte->plt_relocs, GElf_Rela, NULL, NULL);
  }
and removing it... fixes it? 
  ===> Running ltrace -p 169396 ...
  Can't open /home/nabijaczleweli/uwu/repro/ltrace/liblib.so: No such file or 
directory
  Couldn't determine base address of 
/home/nabijaczleweli/uwu/repro/ltrace/liblib.so
  Couldn't load ELF object /home/nabijaczleweli/uwu/repro/ltrace/liblib.so: Bad 
file descriptor
  Can't open /home/nabijaczleweli/uwu/repro/ltrace/liblib.so: No such file or 
directory
  Couldn't determine base address of 
/home/nabijaczleweli/uwu/repro/ltrace/liblib.so
  Couldn't load ELF object /home/nabijaczleweli/uwu/repro/ltrace/liblib.so: Bad 
file descriptor
  DoNothing(0, 0, 0, 0x545634c3)                                                
                            = 0
  sleep(1, 0, 0, 0x545634c3)                                                    
                            = 0
  DoNothing(0, 0, 0, 0x545634c3)                                                
                            = 0

...because it's never been initialised
  (gdb) p lte->plt_relocs
  $2 = {data = 0x0, size = 0, allocated = 0, elt_size = 0}

This is a trivial fix:
  
https://salsa.debian.org/debian/ltrace/-/commit/f09d0e437e506718f8198143f9be95e94dd6792a

Attachment: signature.asc
Description: PGP signature

Reply via email to