pengutronix / genimage

tool to generate multiple filesystem and flash images from a tree
GNU General Public License v2.0
308 stars 110 forks source link

image-android-sparse: use off_t instead of int for lseek return values #160

Closed Bastian-Krause closed 3 years ago

Bastian-Krause commented 3 years ago

On a 64 bit system off_t can hold signed, 64 bit integers. Putting large off_t values in a 32 bit int results in overflows. These overflows trigger the "< 0" check and result in errors. This can be observed on large input images.

lseek() returns an off_t, so introduce an off_t to store its return value appropriately.