Skip to content

Add test about invalid comparison with GMP objects #6553

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

Closed
wants to merge 2 commits into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Dec 29, 2020

Also remove some dead code.

I'm not sure if this might not be a bug? I don't exactly remember the exact semantics about comparisons.

if (Z_TYPE(result) == IS_FALSE) {
return 1;
}
/* result can only be a zend_long if gmp_cmp hasn't thrown an Error */
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this for an EG(exception) check then? Z_LVAL(result) may not be set if an exception has been thrown.

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably should, but I initially dropped this as I was expecting some kind of memory read error or segfault but that didn't happen, will update this.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a ZEND_ASSERT(Z_TYPE(result) == IS_LONG); here.

if (Z_TYPE(result) == IS_FALSE) {
return 1;
}
/* result can only be a zend_long if gmp_cmp hasn't thrown an Error */
Copy link
Member

Choose a reason for hiding this comment

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

Please add a ZEND_ASSERT(Z_TYPE(result) == IS_LONG); here.

@php-pulls php-pulls closed this in 1b5c62f Jan 4, 2021
@Girgias Girgias deleted the gmp-cmp-refactor branch January 4, 2021 13:57
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