AppImageCommunity / libappimage

Implements functionality for dealing with AppImage files
https://appimage.org
Other
46 stars 29 forks source link

fix crash when creating >2GB files on 32bit machine #189

Open hyh19962008 opened 10 months ago

hyh19962008 commented 10 months ago

appimagetool will crash on appimage_get_elf_section_offset_and_length() when creating file larger than 2GB on 32bit machine, because in this line lssek() returns -1 and errno set to EOVERFLOW. map_size with value UINT_MAX(-1) is then passed to mmap().

size_t map_size = (size_t) lseek(fd, 0, SEEK_END);

Adding "#define _FILE_OFFSET_BITS 64" will change off_t to 64bit, then we can get the correct file size from lseek.

related issues:

21

https://github.com/AppImage/AppImageKit/issues/1181

hyh19962008 commented 10 months ago

I was able to create files larger than 4GB now

hyh19962008 commented 9 months ago

I made a build on Ubuntu 16.04(Xenial) for testing, it only works well on native 32bit system. Running it on a 64bit system still gets the same problem. appimagetool-i686-4GBpatched.appimage