delyntaxUG / core-plot

Automatically exported from code.google.com/p/core-plot
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

possible crash in CPTXYAxis.m #575

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
in CPTXYAxis.m
-(void)renderAsVectorInContext:(CGContextRef)context
lines 324 to 337
if the call to viewPointForCoordinateDecimalNumber: on lines 324 or 325 returns 
a bad value (a CGPoint where one or both values is NAN), then an exception is 
thrown that causes an immediate crash at the call to CGContextAddLineToPoint on 
line 329:

> Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void 
CGPathAddLineToPoint(CGMutablePathRef, const CGAffineTransform *, CGFloat, 
CGFloat), file Paths/CGPath.cc, line 224.

granted, there's probably some reason for this condition in the data source or 
delegate code, but tracking it down from this crash is nearly impossible. If it 
happens, it should complain, not crash.

What is the expected output? What do you see instead?
Preferable would be a check against each value:

                if (!isnan(startViewPoint.x) &&
                    !isnan(startViewPoint.y) &&
                    !isnan(endViewPoint.x) &&
                    !isnan(endViewPoint.y)
                    )
                {
                    [theLineStyle setLineStyleInContext:context];
                    CGContextBeginPath(context);
                    CGContextMoveToPoint(context, startViewPoint.x, startViewPoint.y);
                    CGContextAddLineToPoint(context, endViewPoint.x, endViewPoint.y);
                    [theLineStyle strokePathInContext:context];
                }

or perhaps an assert

What version of the product are you using? On what operating system?
Core Plot 1.3 on iOS 7 simulator using XCode 5 DP6

Please provide any additional information below.
This has happened a few times, but one time I could track down and repeat, I 
was providing a single data point to a scatterplot with date on x axis and 
float on y axis.  range of x axis is one day before the one data point to one 
day after.  I'm sure there are other conditions causing my specific issue, 
though.

Original issue reported on code.google.com by asharpod...@gmail.com on 28 Aug 2013 at 5:37

GoogleCodeExporter commented 8 years ago

Original comment by eskr...@mac.com on 29 Aug 2013 at 12:07

GoogleCodeExporter commented 8 years ago

Original comment by eskr...@mac.com on 2 Sep 2013 at 12:34

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 6881dd1d32cb.

Original comment by eskr...@mac.com on 2 Sep 2013 at 12:47