Giter Club home page Giter Club logo

miniz-cpp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

miniz-cpp's Issues

Valgrind - Conditional jump or move depends on uninitialised value(s)

I ran Valgrind on my program, that at some point uses miniz-cpp.

It raised one error for miniz-cpp, which is the following:

==37967== Conditional jump or move depends on uninitialised value(s)
==37967==    at 0x565D9C4: tdefl_find_match (zip_file.hpp:2339)
==37967==    by 0x565D9C4: tdefl_compress_normal (zip_file.hpp:2610)
==37967==    by 0x565EA34: tdefl_compress (zip_file.hpp:2727)
==37967==    by 0x565EBDE: tdefl_compress_buffer (zip_file.hpp:2747)
==37967==    by 0x566506B: mz_zip_writer_add_mem_ex (zip_file.hpp:4430)
==37967==    by 0x5663B0F: mz_zip_writer_add_mem (zip_file.hpp:4190)
==37967==    by 0x566E63D: miniz_cpp::zip_file::writestr(std::string const&, std::string const&) (zip_file.hpp:5514)
==37967==    by 0x566E515: miniz_cpp::zip_file::write(std::string const&, std::string const&) (zip_file.hpp:5504)

I don't think I have the latest code of miniz-cpp so I also put the line here:

    }
    if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32;
    do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) &&
                   (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) );
    if (!probe_len)
    {

Tracking the origin gives:

==44853== Conditional jump or move depends on uninitialised value(s)
==44853==    at 0x564B8A2: tdefl_find_match (zip_file.hpp:2338)
==44853==    by 0x564B8A2: tdefl_compress_normal (zip_file.hpp:2610)
==44853==    by 0x564C8F5: tdefl_compress (zip_file.hpp:2727)
==44853==    by 0x564CA9F: tdefl_compress_buffer (zip_file.hpp:2747)
==44853==    by 0x5652F2C: mz_zip_writer_add_mem_ex (zip_file.hpp:4430)
==44853==    by 0x56519D0: mz_zip_writer_add_mem (zip_file.hpp:4190)
==44853==    by 0x565C4FF: miniz_cpp::zip_file::writestr(std::string const&, std::string const&) (zip_file.hpp:5514)
==44853==    by 0x565C3D7: miniz_cpp::zip_file::write(std::string const&, std::string const&) (zip_file.hpp:5504)
...
==44853==  Uninitialised value was created by a heap allocation
==44853==    at 0x4A37ECB: malloc (vg_replace_malloc.c:307)
==44853==    by 0x56422AB: def_alloc_func (zip_file.hpp:1054)
==44853==    by 0x5652C34: mz_zip_writer_add_mem_ex (zip_file.hpp:4375)
==44853==    by 0x56519D0: mz_zip_writer_add_mem (zip_file.hpp:4190)
==44853==    by 0x565C4FF: miniz_cpp::zip_file::writestr(std::string const&, std::string const&) (zip_file.hpp:5514)
==44853==    by 0x565C3D7: miniz_cpp::zip_file::write(std::string const&, std::string const&) (zip_file.hpp:5504)
...
==44853== 

It would be great if you can solve this issue πŸ˜„

Based on old upstream miniz version with security vulnerabilities

miniz-cpp is based on an old version of zlib/minizip and contains security vulnerabilities. See this example/failing test here: cleeus@d233931

I understand that this project is not in active development but it would be good to point this out in the README, otherwise this code might end up in critical code paths (and it probably alread has). There is a modern, well maintained version of minizip in https://github.com/nmoinvaz/minizip.

build fail, ubuntu 18.04 gcc7.3

Here is the error :
zip_file.hpp:5611:30: error: invalid conversion from β€˜std::size_t ()(void, uint64_t, const void*, std::size_t) {aka long unsigned int ()(void, long unsigned int, const void*, long unsigned int)}’ to β€˜mz_file_write_func {aka long unsigned int ()(void, long long unsigned int, const void*, long unsigned int)}’ [-fpermissive]
archive_->m_pWrite = &detail::write_callback;

build and works well on macOS 10.14, clang v10

Missing `<cstring>` include

On line 5980 you use std::strlen. The namespaced version of this function is not defined in "string.h", only in <cstring>.

This leads to a compilation error.

Is there a way to save a file to an archive that already exists?

So I want to add a save file to an archive. Because that file already exists it just "stacks" the same files on top of each other with the same filename. Is there a way to overwrite the existing file? I don't want to unpack the complete archive because that would take too long for just saving in the application.

Duplicated symbols

Seems like all function declarations should be marked as static for correct linking from multiple translation units.

more elaborate example

Could you provide an example on how to read actual data?

For example, use the zip command to compress a text file:

zip test.zip test.txt

And then your example would write on screen the test.txt original content.

Thanks

Add documentation

Would be nice to have a real documentation instead of guessing what method does what. :)

Overwrite a file in a zip

Is there a way to overwrite a file in a zip? Or delete it? Because when using writestr it just creates file with same name in the zip, which later obviously does not work correctly.

Directory creation upon calling extractall()

Calling "extractall" on a zip file doesn't create folders which exist in the archive, therefore not extracting file that exist within those folders. I would guess this is a limitation of fstream. For what it's worth, this was seen on Windows 7.

MacOS Symlink

Hi,

Does this lib support MacOS symlink as zip command do (--symlink option) ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.