Bug 246 : Buffer overflow in PLine.java
Last modified: 2008-10-21 11:52




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
chrishoge
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2005-12-14 10:27
In some instances the computed offset for the function drawLine_plain_spatial() in PLine.java
overflows the z-buffer when drawing in P3D mode.
Additional Comment #1 From fry 2005-12-14 12:13
can you post an example here as an attachment? preferably the minimum code that will
reproduce the issue?
Additional Comment #2 From chrishoge 2005-12-14 12:44
I'm working on creating a reduced example right now. The bug happens over 7000 frames into
a 3-D rendering of the Lorenz system (with camera tracking using ocd). I need to isolate the
rendering state then prune off the bits that aren't relevent to the bug.

I patched the code by adding bounds checking to the "if" statements in drawLine_plain_spatial,
but as you can imagine this causes a small performance hit.
Additional Comment #3 From chrishoge 2005-12-14 16:12
// This code causes the bug Processing v97
// stack trace follows code

import damkjer.ocd.*;
Camera coasterCam;

size( 450, 300, P3D );
coasterCam = new Camera( this );
coasterCam.jump( 101.387505, 42.80986, 191.80159 );
coasterCam.aim( 169.18607, 129.64006, 128.18642 );
coasterCam.feed();
line( 49.30374, 135.95808, 263.43115, 36.522545, 117.65399, 265.765 );

//java.lang.ArrayIndexOutOfBoundsException: 135324
// at processing.core.PLine.drawLine_plain_spatial(PLine.java:757)
// at processing.core.PLine.draw(PLine.java:404)
// at processing.core.PGraphics3.render_lines(PGraphics3.java:1440)
// at processing.core.PGraphics3.endShape(PGraphics3.java:1044)
// at processing.core.PGraphics3.line(PGraphics3.java:2107)
// at processing.core.PApplet.line(PApplet.java:6056)
// at Temporary_28_4443.draw(Temporary_28_4443.java:27)
// at processing.core.PApplet.display(PApplet.java:1210)
// at processing.core.PGraphics.requestDisplay(PGraphics.java:520)
// at processing.core.PApplet.run(PApplet.java:1028)
// at java.lang.Thread.run(Thread.java:552)
Additional Comment #4 From chrishoge 2005-12-14 16:35
// This code causes the bug Processing v97
// stack trace follows code

size( 450, 300, P3D );
camera(101.387505, 42.80986, 191.80159, 169.18607, 129.64006, 128.18642, 0, -1, 0 );
line( 49.30374, 135.95808, 263.43115, 36.522545, 117.65399, 265.765 );

//java.lang.ArrayIndexOutOfBoundsException: 135324
// at processing.core.PLine.drawLine_plain_spatial(PLine.java:757)
// at processing.core.PLine.draw(PLine.java:404)
// at processing.core.PGraphics3.render_lines(PGraphics3.java:1440)
// at processing.core.PGraphics3.endShape(PGraphics3.java:1044)
// at processing.core.PGraphics3.line(PGraphics3.java:2107)
// at processing.core.PApplet.line(PApplet.java:6056)
// at Temporary_28_4443.draw(Temporary_28_4443.java:27)
// at processing.core.PApplet.display(PApplet.java:1210)
// at processing.core.PGraphics.requestDisplay(PGraphics.java:520)
// at processing.core.PApplet.run(PApplet.java:1028)
// at java.lang.Thread.run(Thread.java:552)
Additional Comment #5 From fry 2005-12-15 09:10
thanks, that's a very helpful example so i can track it down without having
to install the extra library. will look into it.
Additional Comment #6 From fry 2006-12-01 06:53
may be the same as bug #462.
Additional Comment #7 From fry 2008-10-17 07:47
fixed for 0151.