Skip to content

Conversation

@devnexen
Copy link
Member

@devnexen devnexen commented Nov 2, 2025

  • forgotten remaining libzip < 1.0.0 code path.
  • earlier return on invalid inputs from some ZipArchive methods.

@devnexen devnexen marked this pull request as ready for review November 2, 2025 22:49
Comment on lines 2609 to 2624
if (index < 0) {
RETURN_FALSE;
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess it might make sense to make those sorts of conditions a warning/value error in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I kept "api compatible" for now on purpose.

Comment on lines 3019 to 3022
if (method < 0) {
RETURN_FALSE;
}
RETVAL_BOOL(zip_compression_method_supported((zip_int32_t)method, enc));
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this a problem if method is larger than a 32bit int but still positive on x64?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point

Comment on lines 2400 to 2403
if (comp_method < -1 || comp_method > INT_MAX) {
zend_argument_value_error(2, "must be between 0 and %d", INT_MAX);
RETURN_THROWS();
}
Copy link
Member

Choose a reason for hiding this comment

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

Is it between 0 and INT_MAX or -1 and INT_MAX? Because the condition seems to indicate between -1 and INT_MAX

zend_argument_value_error(1, "must be between 0 and %u", USHRT_MAX);
RETURN_THROWS();
}
RETVAL_BOOL(zip_encryption_method_supported((zip_uint16_t)method, enc));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
RETVAL_BOOL(zip_encryption_method_supported((zip_uint16_t)method, enc));
RETURN_BOOL(zip_encryption_method_supported((zip_uint16_t)method, enc));

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants