AppImage / AppImage/AppImageKit

read_elf_e_machine_field should be more robust

Đang mở
#918 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
9.4k
Fork
588
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.