AppImage / AppImage/AppImageKit

read_elf_e_machine_field should be more robust

Abierto
#918 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Sin datos de lenguaje
Estrellas
9.4k
Forks
588
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.