Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

warning in ideviceinstaller.c

#217

Just cloned the latest ideviceinstaller git and built on arch linux, using gcc version 4.6.0 20110513 and libzip 0.10

Line 166 in ideviceinstaller.c gives the following warning:
error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

Turns out zip_fread returns signed int64 while zip_stat size is an unsigned int64.

I was able to fix with the following patch that tries to do a safe cast. Hopefully it is at least helpful:

--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -163,7 +163,7 @@ static int zip_f_get_contents(struct zip *zf, const char *filename, int locate_f

        }
 
        *buffer = malloc(zs.size);
-       if (zip_fread(zfile, *buffer, zs.size) != zs.size) {
+       if (zs.size>LLONG_MAX || zip_fread(zfile, *buffer, zs.size) != (zip_int64_t)zs.size) {
                fprintf(stderr, "ERROR: zip_fread %" PRIu64 " bytes from '%s'\n", (uint64_t)zs.size, filename);
                free(*buffer);
                *buffer = NULL;

Reported by wizzrobe · May 18th, 2011 @ 09:19 PM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. Martin S.
    Martin S.
    • State changed from new to resolved
    • Tag set to ideviceinstaller, libzip

    May 17th, 2012 @ 04:12 PM

  2. wizzrobe
    wizzrobe

    Great, thanks for fixing.

    May 17th, 2012 @ 04:16 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.