-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Segmentation fault with typo in iterate(x, n)
#29532
Comments
Simpler reproduction: struct Foo end
Base.iterate(::Foo) = (0, 0)
Base.iterate(::Foo, n) = n < 1000000 ? (0, n+1) : nothing
Base.length(::Foo) = 10
collect(i for i in Foo())
Lines 655 to 669 in 1968b23
assume the dest array to be large enough to hold all generated elements, but it is allocated based on the length . I guess we could just replace the while true with while i <= lastindex(dest) ? Then we would just produce the first length elements, which seems ok.
|
Ref. #29458 which should hopefully be made to also fix this. |
Dup of #28763 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note the typo in
Base.iterate(a, n) = iterate(a.data)
(missingn
on the right hand side):The text was updated successfully, but these errors were encountered: