Skip to content

Using mz_stream_open() on buffered stream causes infinite recursion #216

@chenxiaolong

Description

@chenxiaolong

Using mz_stream_open() on a buffered stream seems to cause minizip to get stuck in infinite recursion.
For example, if I run this sample program: https://gist.github.com/chenxiaolong/dbab3fbef51b9d0fa969e220dbb85967, it hangs indefinitely and the stack trace shows:

[build] pstack $(pidof a.out)
#0  mz_stream_open (stream=0x16f4290, path=0x7ffc1a039e70 "/tmp/foobar.zip", mode=1) at /stuff/Android/DualBootPatcher/minizip.cxl/src/mz_strm.c:26
#1  0x000000000040134f in main (argc=2, argv=0x7ffc1a0396d8) at test.c:66

I haven't looked too deeply into the code, but should these two functions be referring to the base stream instead of the buf stream?

https://github.com/nmoinvaz/minizip/blob/13a12e32abca2af5523b403ff8878277912c20d6/src/mz_strm_buf.c#L67-L77

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedIssue or bug has been fixed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions