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

Possible Infinite Loop in LineAnnotation.GetPoints() when ActualMinimum=ActualMaximum #1029

Closed
nzain opened this issue Dec 7, 2016 · 3 comments · Fixed by #1112
Closed
Labels

Comments

@nzain
Copy link
Contributor

nzain commented Dec 7, 2016

Steps to reproduce

  1. Create a y-axis has StartPosition=EndPosition=0, but do not use LinearAxis (derived classes hit this issue, too)
  2. Create a vertical LineAnnotation

Platform: any
.NET version: any

Expected behaviour

No exception is thrown. Infinite loops have to be avoided at all times either by checking the increment or using a maximum iteration count.

Actual behaviour

When either the X or Y Axis are not instances of LinearAxis (thus, bool curvedLine is true), the line annotation produces not two but many points in LineAnnotation.GetPoints(). It produces an infinite "while (true)" loop because the increment is zero because ActualMaximum=ActualMinimum.

The result is a OutOfMemoryException:
image

Suggested Fix Strategy

When ActualMaximum=ActualMinimum the GetPoints() method can quickly return an empty result.

@objorke
Copy link
Member

objorke commented Dec 8, 2016

That´s an interesting axis :-) There should be an example in the ExampleLibrary with start and end position at zero.
I agree this should be handled, no exception thrown.

@bryanfree66
Copy link
Contributor

Can I take this one?

@nzain
Copy link
Contributor Author

nzain commented Apr 25, 2017

Feel free to take it.

The "interesting" axis was a simple trick to hide it. I think there is a "IsVisible" property, too - not sure why I did it this way. However, infinite loops are a no-go (even if you're "holding it wrong") and easy to avoid, too. Great library nevertheless 🥇

objorke pushed a commit to objorke/oxyplot that referenced this issue Jun 18, 2017
…k if ActualMaximumX==ActualMinimumX for non-curved lines.
objorke pushed a commit to objorke/oxyplot that referenced this issue Jun 18, 2017
objorke added a commit to objorke/oxyplot that referenced this issue Jun 18, 2017
objorke added a commit to objorke/oxyplot that referenced this issue Jun 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants