Ticket #60396: 25-fix-false-overlapped-components-detection-on-32-bit-systems.patch

File 25-fix-false-overlapped-components-detection-on-32-bit-systems.patch, 2.0 KB (added by gfiumara (Greg Fiumara), 4 years ago)
  • extract.c

    From 13f0260beae851f7d5dd96e9ef757d8d6d7daac1 Mon Sep 17 00:00:00 2001
    From: Mark Adler <madler@alumni.caltech.edu>
    Date: Sun, 9 Feb 2020 07:20:13 -0800
    Subject: [PATCH] Fix false overlapped components detection on 32-bit systems.
    
    32-bit systems with ZIP64_SUPPORT enabled could have different
    size types for zoff_t and zusz_t. That resulted in bad parameter
    passing to the bound tracking functions, itself due to the lack of
    use of C function prototypes in unzip. This commit assures that
    parameters are cast properly for those calls.
    
    This problem occurred only for ill-chosen make options, which give
    a 32-bit zoff_t. A proper build will result in a zoff_t of 64 bits,
    even on 32-bit systems.
    ---
     extract.c | 7 ++++---
     1 file changed, 4 insertions(+), 3 deletions(-)
    
    diff --git a/extract.c b/extract.c
    index 1b73cb0..d9866f9 100644
    a b static ZCONST char Far OverlappedComponents[] = 
    329329
    330330
    331331/* A growable list of spans. */
    332 typedef zoff_t bound_t;
     332typedef zusz_t bound_t;
    333333typedef struct {
    334334    bound_t beg;        /* start of the span */
    335335    bound_t end;        /* one past the end of the span */
    int extract_or_test_files(__G) /* return PK-type error code */ 
    518518        return PK_MEM;
    519519    }
    520520    if ((G.extra_bytes != 0 &&
    521          cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
     521         cover_add((cover_t *)G.cover,
     522                   (bound_t)0, (bound_t)G.extra_bytes) != 0) ||
    522523        (G.ecrec.have_ecr64 &&
    523524         cover_add((cover_t *)G.cover, G.ecrec.ec64_start,
    524525                   G.ecrec.ec64_end) != 0) ||
    static int extract_or_test_entrylist(__G__ numchunk, 
    12161217
    12171218        /* seek_zipf(__G__ pInfo->offset);  */
    12181219        request = G.pInfo->offset + G.extra_bytes;
    1219         if (cover_within((cover_t *)G.cover, request)) {
     1220        if (cover_within((cover_t *)G.cover, (bound_t)request)) {
    12201221            Info(slide, 0x401, ((char *)slide,
    12211222              LoadFarString(OverlappedComponents)));
    12221223            return PK_BOMB;