JDK-8103114 : FX 8 3D: Need to validate Mesh's data size
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-05-16
  • Updated: 2015-06-16
  • Resolved: 2013-10-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Blocks :  
Relates :  
Description
Need to ensure that the indices in the face array is within the range of the data buffers it refers to.
Comments
Thanks Kevin, Yao. Se we do not need extra tests for this tweak
15-01-2014

We do have a unit test for this. Yao identified it above, but here it is again: Unit test: test3d.TriangleMeshTest It is in the following changeset: http://hg.openjdk.java.net/openjfx/8/graphics/rt/rev/1f4c3ee0d483
14-01-2014

[~alexanderioffe] Unit test is at modules\graphics\src\test\java\javafx\scene\shape\TriangleMeshTest.java The attached test MeshViewUpdate.java is not in the ws, which manipulate mesh data at runtime, maybe more relevant to this issue.
14-01-2014

Do we have a unit test in WS? What is the changeset for it?
14-01-2014

Test with: attached test MeshViewUpdate.java Unit Test: TriangleMeshTest.java
08-10-2013

If we decide to be tolerant on size validation, meaning not require array length to be multiple of 2, 3 or 6, but always clamp to the most available chunk when build geometry. Probably we only require RT-26587.
29-09-2013

Rescheduled for next sprint(after J1). May require some feedback from Scene Graph team.
13-09-2013

The exception should because the validation "faceSmoothingGroups.length has to be equal to (faces.length / NUM_COMPONENTS_PER_FACE)". The limitation MAX_LENGTH may be outdated for now.
12-09-2013

I see three potential problems that will need to be addressed in the reworked fix: 1) The check for 65536 vertices is wrong. It is unlimited (other than naturally by a 32-bit int index) on desktop. On embedded it is limited to 65536. 2) Rather than throwing an exception, we have specified to log a warning and draw nothing. 3) Since the faces, smoothing groups, points, and texCoords arrays are all independently modified, there will be transient inconsistency, so any checking needs to be done at the time when all are valid (e.g., it cannot be done at set or validation time). I suspect it is the latter of these that caused the regression in 3D viewer, but I cannot be certain.
12-09-2013

Backed out original fix due to regression in 3D viewer (along with other potential issues that we are discussing).
12-09-2013

Test with Unit Tests: modules/graphics/src/test/java/javafx/scene/shape/TriangleMeshTest.java
11-09-2013

Here is a todo in TriangleMesh: + // TODO: 3D - Need to validate the size and range of these arrays. + // A warning will be recorded to the logger and the mesh will have an empty + // bounds if the validation failed. (RT-30451) + // The maximum length for points (65536 * 3), texCoords (65536 * 2) + // or faces (65536 * 6) arrays. The value in faces must be within range and + // length has to be divisable by 6. private final ObservableFloatArray points = FXCollections.observableFloatArray(); private final ObservableFloatArray texCoords = FXCollections.observableFloatArray(); private final ObservableIntegerArray faces = FXCollections.observableIntegerArray(); private final ObservableIntegerArray faceSmoothingGroups = FXCollections.observableIntegerArray();
21-05-2013

Note that for TriangleMesh the maximum length of points, texCoords or faces arrays can not exceed 65535. The length of faces array has to be divisible by 3. A warning will be recorded to the logger and the mesh will have an empty bounds if either its points, texCoords, or faces arrays exceeded 65535 or faces array is not divisible by 3.
21-05-2013