summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
Diffstat (limited to 'rs/java/android/renderscript/Allocation.java')
-rw-r--r--rs/java/android/renderscript/Allocation.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index 69103e872654..e979a1bed7a7 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -1262,6 +1262,10 @@ public class Allocation extends BaseObj {
private void copyTo(Object array, Element.DataType dt, int arrayLen) {
Trace.traceBegin(RenderScript.TRACE_TAG, "copyTo");
+ if (dt.mSize * arrayLen < mSize) {
+ throw new RSIllegalArgumentException(
+ "Size of output array cannot be smaller than size of allocation.");
+ }
mRS.validate();
mRS.nAllocationRead(getID(mRS), array, dt);
Trace.traceEnd(RenderScript.TRACE_TAG);