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

Infinite loop on CArray[].new #5663

Closed
p6rt opened this issue Sep 12, 2016 · 5 comments
Closed

Infinite loop on CArray[].new #5663

p6rt opened this issue Sep 12, 2016 · 5 comments
Labels
Bug

Comments

@p6rt
Copy link

@p6rt p6rt commented Sep 12, 2016

Migrated from rt.perl.org#129256 (status was 'resolved')

Searchable as RT129256$

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 12, 2016

From perl6@6dof.xyz

How to reproduce​:

  perl6 -e 'use NativeCall; CArray[uint8].new(())'

Fix (not tested)​:

--- a/lib/NativeCall/Types.pm6
+++ b/lib/NativeCall/Types.pm6
@​@​ -162,7 +162,7 @​@​ our class CArray is repr('CArray') is array_type(Pointer) {
  multi method new() { nqp​::create(self) }
  multi method new(*@​values) { self.new(@​values) }
  multi method new(@​values) {
- nextsame unless @​values;
+ nextsame unless @​values && @​values.elems > 0;
  my $result := self.new();
  my int $n = @​values.elems;
  my int $i;

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 12, 2016

From @zoffixznet

Thanks for the report!

Unfortunately the fix you provided is a no-op, because empty arrays are falsy, so the check doesn't add anything extra.

The issue was the nextsame candidate was the one with the slurpy that called the current candidate back again, resulting in an infiniloop.

The issue has now been resolved in rakudo/rakudo@804bf67

Tests added in the same commit.

Cheers,
ZZ

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 12, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 12, 2016

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this Sep 12, 2016
@p6rt
Copy link
Author

@p6rt p6rt commented Sep 13, 2016

From cedric@6dof.xyz

Many thanks!

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.