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

Fix uniqint SIGSEGV for objects with no int overload #137

Closed
wants to merge 1 commit into from

Conversation

zhmylove
Copy link

In case uniqint takes several objects, it always tries to call their int overload using amagic_call. This patch fixes the case when amagic_call returned NULL resulting into Segmentation Violation. Several tests are also added to ensure proper objects handling.

Problem:
The code below expected to work but crashes with SIGSEGV.

use List::Util qw( uniqint );
uniqint bless {}, __PACKAGE__; # given __PACKAGE__ has no 'int' overload unlike Math::BigInt

Desired behaviour:
Returns a list with single reference to an object.

In case uniqint takes several objects, it always tries to call their
int overload using amagic_call.  This patch fixes the case when
amagic_call returned NULL resulting into Segmentation Violation.
Several tests are also added to ensure proper objects handling.

Signed-off-by: Sergei Zhmylev <[email protected]>
@zhmylove
Copy link
Author

@leonerd may I ask you to take a look on the PR as it fixes a segfault in uniqint() please

@zhmylove
Copy link
Author

Anyone?

@zhmylove
Copy link
Author

Perl5.6 check fails due to CI issue

@sisyphus
Copy link
Contributor

Consider posting to the p5p mailing list about this lack of response.
It's an issue that should be addressed, and someone on that mailing list (who is not even currently aware of this issue) might be able to initiate some action.

@zhmylove
Copy link
Author

I decided to use croak instead of implicit integer cast.
Opened #138

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