[Renderscript] Add check for Allocation.copyTo(Array) and

Fix the input allocation type check for Histogram Intrinsic.

Bug: 19035242
Change-Id: I0ef2672bf816854db90fc92dc9ef51d1d231c246
This commit is contained in:
Miao Wang
2015-01-15 11:09:23 -08:00
parent 2980719512
commit b590b354ef
2 changed files with 10 additions and 6 deletions

View File

@@ -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);