AppImage / AppImage/AppImageKit

read_elf_e_machine_field should be more robust

Offen
#918 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Keine Sprachdaten
Sterne
9.4k
Forks
588
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.