Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Reading binary stream to determine file format code reading data exception #133

Open
1 task done
psvajaz opened this issue May 4, 2023 · 1 comment
Open
1 task done

Comments

@psvajaz
Copy link

psvajaz commented May 4, 2023

bit7z version

4.0.x RC

Compilation options

BIT7Z_AUTO_FORMAT, BIT7Z_AUTO_PREFIX_LONG_PATHS

7-zip version

v22.01

7-zip shared library used

7z.dll / 7z.so

Compilers

MSVC

Compiler versions

MSVC2017

Architecture

x86

Operating system

Windows

Operating system versions

Windows 11

Bug description

bitinputarchive.cpp -> openArchive -> Streamfile_stream = bit7z::make_com< CFileInStream, IInStream >( arc_path );
bitexception.cpp -> CFileInStream > mFileStream.rdbuf()->pubsetbuf( mBuffer.data(), buffer_size );
Loading file binary to mBuffer is all 0x00.

mFileStream.rdbuf()->pubsetbuf( mBuffer.data(), buffer_size );
modify to
mFileStream.read(mBuffer.data(), buffer_size);
is ok.

but return to readSignature is all 0x00

Steps to reproduce

No response

Expected behavior

No response

Relevant compilation output

No response

Code of Conduct

@rikyoz
Copy link
Owner

rikyoz commented May 5, 2023

Hi!

Sorry, could you give more details on the issue? What are you trying to achieve?
Thanks!

mFileStream.rdbuf()->pubsetbuf( mBuffer.data(), buffer_size );
modify to
mFileStream.read(mBuffer.data(), buffer_size);
is ok.
but return to readSignature is all 0x00

The code mFileStream.rdbuf()->pubsetbuf( mBuffer.data(), buffer_size ); in CFileInStream's constructor is correct.
In the constructor, we are not trying to read the file; rather, we are setting the buffer that will be used for the subsequent read operations performed by 7-zip.

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

No branches or pull requests

2 participants