8000 missing unztell() function · Issue #319 · zlib-ng/minizip-ng · GitHub
[go: up one dir, main page]

Skip to content

missing unztell() function #319

Closed
Closed

Description

@praiskup

Forwarding from https://bugzilla.redhat.com/show_bug.cgi?id=1632206 :

Jason Tibbitts 2018-09-24 18:39:22 CEST wrote:

Seems the new minizip lacks the unztell() function so more than a rebuild is required. I could conceivably do a port to the new minizip or to some other library, but this would all be to avoid the use of a single unzip.c source file that's already part of the source.

So I've just reverted to using the bundled bit. It's not called on untrusted data so it shouldn't be particularly problematic.

Activity

  1. jasontibbitts commented on Sep 25, 2018

    @jasontibbitts

    That was me. The code that calls this is pretty old and part of a game engine. For more than a decade, Fedora has been unbundling the built-in unzip.c file and instead calling into minizip but the new minizip library doesn't have that unztell() function as far as I could tell. This obviously isn't a huge deal, but this ticket was filed.

    The only code which calls this function in the relevant program is:

    int U4FILE_zip::seek(long offset, int whence) {
        char *buf;
        long pos;
    
        ASSERT(whence != SEEK_END, "seeking with whence == SEEK_END not allowed with zipfiles");
        pos = unztell(zfile);
        if (whence == SEEK_CUR)
            offset = pos + offset;
        if (offset == pos)
            return 0;
        if (offset < pos) {
            unzCloseCurrentFile(zfile);
            unzOpenCurrentFile(zfile);
            pos = 0;
        }
        ASSERT(offset - pos > 0, "error in U4FILE_zip::seek");
        buf = new char[offset - pos];
        unzReadCurrentFile(zfile, buf, offset - pos);
        delete [] buf;
        return 0;
    }
    
    long U4FILE_zip::tell() {
        return unztell(zfile);
    }
    

    The implementation of that function in the bundled unzip.c file (which we were previously replacing with minizip):

    /*
      Give the current position in uncompressed data
    */
    extern z_off_t ZEXPORT unztell (unzFile file)
    {
        unz_s* s;
        file_in_zip_read_info_s* pfile_in_zip_read_info;
        if (file==NULL)
            return UNZ_PARAMERROR;
        s=(unz_s*)file;
        pfile_in_zip_read_info=s->pfile_in_zip_read;
    
        if (pfile_in_zip_read_info==NULL)
            return UNZ_PARAMERROR;
    
        return (z_off_t)pfile_in_zip_read_info->stream.total_out;
    }
    
  2. nmoinvaz commented on Sep 25, 2018

    @nmoinvaz
    Member

    I have added the missing functions. Let me know if you have any problems.

  3. jasontibbitts commented on Sep 27, 2018

    @jasontibbitts

    Thanks! Once a release with this hits Fedora I'll see about switching back to the previous setup.

  4. endrift commented on Nov 4, 2020

    @endrift

    The function upstream is unztell, but it's been added as unzTell here, which is causing compatibility issues for programs that expect the symbol name to match.

  5. nmoinvaz commented on Nov 4, 2020

    @nmoinvaz
    Member

    unztell has been exported since version 2.8.3.

  6. endrift commented on Nov 4, 2020

    @endrift

    So it has, but unztell64 is still missing, which is what was causing the issue for me.

  7. nmoinvaz commented on Nov 4, 2020

    @nmoinvaz
    Member

    It appears to be resolved in #529

  8. endrift commented on Nov 4, 2020

    @endrift

    Ah, thanks. I missed that when I was searching the repo before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityBackwards compatibilityfixedIssue or bug has been fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0