Add script to script call support. Add exception to catch out of bound index data when added to TriangleMeshBuilder.
diff --git a/graphics/java/android/renderscript/SimpleMesh.java b/graphics/java/android/renderscript/SimpleMesh.java
index b422702..0ad093e 100644
--- a/graphics/java/android/renderscript/SimpleMesh.java
+++ b/graphics/java/android/renderscript/SimpleMesh.java
@@ -290,6 +290,11 @@
}
public void addTriangle(int idx1, int idx2, int idx3) {
+ if((idx1 >= mVtxCount) || (idx1 < 0) ||
+ (idx2 >= mVtxCount) || (idx2 < 0) ||
+ (idx3 >= mVtxCount) || (idx3 < 0)) {
+ throw new IllegalStateException("Index provided greater than vertex count.");
+ }
if ((mIndexCount + 3) >= mIndexData.length) {
short t[] = new short[mIndexData.length * 2];
System.arraycopy(mIndexData, 0, t, 0, mIndexData.length);