-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
... in scattergl positions cleanup.
Codepen from #3197 but using a bundle off this branch: https://codepen.io/etpinard/pen/xyvGRJ |
src/traces/scattergl/index.js
Outdated
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]))) { |
There was a problem hiding this comment.
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.
💃 |
Thanks for the quick review @alexcjohnson ! I'll make another patch release tomorrow morning. |
fixes #3197
cc @plotly/plotly_js