AppImage / AppImage/AppImageKit

read_elf_e_machine_field should be more robust

オープン
#918 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
言語のデータがありません
スター
9.4k
フォーク
588
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。