8000 fix or drop zipOpen2/unzOpen2 · Issue #566 · zlib-ng/minizip-ng · GitHub
[go: up one dir, main page]

Skip to content

fix or drop zipOpen2/unzOpen2 #566

Closed

Description

@berolinux

zipOpen2 and unzOpen2 currently cast a zlib_filefunc_def* to mz_stream_vtbl*
Since those structs contain different functions with different parameters in a different order, this will crash the calling application at best and corrupt data (unzOpen2 actually calling into a function that opens the file for writing) at worst.

The functions should either be implemented in a compatible way, or at least removed so users don't think this is going to work before actually running into something that calls the functions.

Activity

  1. nmoinvaz commented on May 8, 2021

    @nmoinvaz
    Member

    I have implemented the ioapi support. Only thing missing is wide-character ioapi support for Windows. If somebody really cares about that they can figure it out themselves.

  2. gvollant commented on May 8, 2021

    @gvollant
    Collaborator

    my very old code was

    
    #ifdef IOWIN32_USING_WINRT_API
    #ifdef UNICODE
        if ((filename!=NULL) && (dwDesiredAccess != 0))
            hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
    #else
        if ((filename!=NULL) && (dwDesiredAccess != 0))
        {
            WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
            MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
            hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
        }
    #endif
    #else
        if ((filename!=NULL) && (dwDesiredAccess != 0))
            hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
    #endif
    

    If I remember, that was for WINRT which was not compatible with Ansi API....

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0