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

Guard against infinite loops during scattergl line/fill positions cleanup #3199

Merged
merged 7 commits into from
Oct 31, 2018

Conversation

etpinard
Copy link
Contributor

fixes #3197

cc @plotly/plotly_js

@etpinard etpinard added bug something broken status: reviewable labels Oct 31, 2018
@etpinard
Copy link
Contributor Author

Codepen from #3197 but using a bundle off this branch: https://codepen.io/etpinard/pen/xyvGRJ

firstptdef += 2;
}
var lastptdef = srcPos.length - 2;
while(isNaN(srcPos[lastptdef]) || isNaN(srcPos[lastptdef + 1])) {
lastptdef += -2;
while(lastptdef > -1 && (isNaN(srcPos[lastptdef]) || isNaN(srcPos[lastptdef + 1]))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

even better: while(lastptdef > firstptdef && ... would skip this second loop altogether in the failing case.

BTW do we need this pos = pos.concat... thing at all? Can't we just do lineOptions.positions = srcPos.slice(...)? It's needed in the fill section below but I don't see why it'd be needed here. In fact, even that slice seems like it could be omitted when we didn't drop any points on either end.

@alexcjohnson
Copy link
Collaborator

💃

@etpinard
Copy link
Contributor Author

Thanks for the quick review @alexcjohnson !

I'll make another patch release tomorrow morning.

@etpinard etpinard merged commit c1c0d04 into master Oct 31, 2018
@etpinard etpinard deleted the catch-nan-while-loops branch October 31, 2018 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plotly 1.42.1 goes unresponsive
2 participants