rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
602 stars 110 forks source link

[Bug]: #201

Closed wzwangyike closed 3 months ago

wzwangyike commented 3 months ago

bit7z version

4.0.x

Compilation options

BIT7Z_AUTO_FORMAT, BIT7Z_GENERATE_PIC, BIT7Z_USE_NATIVE_STRING

7-zip version

v23.01

7-zip shared library used

7z.dll / 7z.so

Compilers

GCC

Compiler versions

4.9.2

Architecture

x86_64

Operating system

Linux

Operating system versions

UOS20(1060)

Bug description

BitArchiveReader archive(lib, strCompressFile); run crash.

Steps to reproduce

  1. i use centos6 gcc 4.9.2 to build 7z.so , bit7z.a ,and xxx.so(using bit7z.a)
  2. i push xxx.so to UOS and run to BitArchiveReader archive(lib, strCompressFile);
  3. it will crash with iUnknow.Release.
  4. image

    this is the crash info.

the point 0x7fffc806e010 is CFileInStream .

the 0x7fffc806e010 frist ~ is tmp CFileInStream in make_com function

I ues the last master's code , also have this crash.

Expected behavior

No response

Relevant compilation output

No response

Code of Conduct

rikyoz commented 3 months ago

Hi!

i use centos6 gcc 4.9.2 to build 7z.so , bit7z.a ,and xxx.so(using bit7z.a)

Are you building the 7z.so from the 7-Zip project or from p7zip?

On Linux and MacOS, 7-zip v23.01 introduced breaking changes to the IUnknown interface. If you build bit7z for such a version of 7-zip (the default), it will not support using the shared libraries from earlier versions of 7-zip (or from p7zip).

In the past, bugs similar to yours have been caused by this breaking change, so the BIT7Z_USE_LEGACY_IUNKNOWN option was introduced to make bit7z compatible with older 7-zip and p7zip libraries.

Does building bit7z with the BIT7Z_USE_LEGACY_IUNKNOWN option enabled (i.e. -DBIT7Z_USE_LEGACY_IUNKNOWN=ON) fix the problem?

wzwangyike commented 3 months ago

i change cmake to case this bug..so sorry fot this bug

rikyoz commented 3 months ago

No problem!

Thank you for using this library! 🙏