AppImage / AppImage/AppImageKit

read_elf_e_machine_field should be more robust

Aperta
#918 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
9.4k
Fork
588
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

The current implementation of read_elf_e_machine_field() in
https://github.com/AppImage/AppImageKit/blob/master/src/appimagetool.c
skips the first 18 bytes of a file, then reads an int16 and guesses the machine type from it.

That's assuming *every* file in the world has an ELF header, which is too fragile an assumption, it fails e.g. here:
/appdir2/usr/bin/bsewavetool used for determining architecture x86_64
/appdir2/usr/bundle/app/node_modules/rc/index.js used for determining architecture armhf
/appdir2/usr/bundle/app/assets/v8bse.node used for determining architecture x86_64

To improve robustness, the read_elf_e_machine_field() should check the file start for the ELF magic and ignore files that don't carry the bytes: 0x7f,'E','L','F'. See also:

http://www.sco.com/developers/gabi/2000-07-17/ch4.eheader.html#elfid

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.