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

opt: add debug log and more friendly error message #2039

Open
wants to merge 6 commits into
base: staged
Choose a base branch
from

Conversation

xiaoyifang
Copy link
Owner

No description provided.

@@ -108,8 +106,10 @@ bool IndexedZip::loadFile( uint32_t offset, vector< char > & data )
return false;
}

if ( inflate( &stream, Z_FINISH ) != Z_STREAM_END ) {
qDebug( "Not zstream end!" );
int ret = inflate( &stream, Z_FINISH );
Copy link
Collaborator

@shenlebantongying shenlebantongying Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a few lines below, the infalteEnd doesn't check inflateEnd( &stream) != Z_OK.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is neccessary to check the inflateEnd result?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the source code, it is some sanity checks, one of them appears to be checking z_stream_s->state.

I am not 100% certain if it is needed because inflate could return Z_STREAM_ERROR and various other errors.

I think we should check it religiously to make sure all errors are handled.

https://github.com/madler/zlib/blob/ef24c4c7502169f016dcd2a26923dbaf3216748c/inflate.c#L1266-L1276

https://github.com/madler/zlib/blob/ef24c4c7502169f016dcd2a26923dbaf3216748c/inflate.c#L94-L104

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

Successfully merging this pull request may close these issues.

2 participants