diff options
author | Jason Sams <jsams@google.com> | 2014-03-05 16:09:02 -0800 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2014-03-05 16:09:02 -0800 |
commit | 678cc7fe9fef00fb3381e64f95cc6907796bcd8e (patch) | |
tree | ffaba9543cfbc5de64b73b6b895a63ffef87bd87 /rs/java/android/renderscript/Script.java | |
parent | 22f66b76f5e49704f3be76ad3fff7e4b5456864d (diff) |
Validate objects are from the correct context.
Change-Id: I7d87b0e253b8d2e36d1aed790cfe3a7dd23e158f
Diffstat (limited to 'rs/java/android/renderscript/Script.java')
-rw-r--r-- | rs/java/android/renderscript/Script.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java index a1f228718436..0e46f94a583e 100644 --- a/rs/java/android/renderscript/Script.java +++ b/rs/java/android/renderscript/Script.java @@ -128,6 +128,9 @@ public class Script extends BaseObj { * */ protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v) { + mRS.validate(); + mRS.validateObject(ain); + mRS.validateObject(aout); if (ain == null && aout == null) { throw new RSIllegalArgumentException( "At least one of ain or aout is required to be non-null."); @@ -152,6 +155,9 @@ public class Script extends BaseObj { * */ protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v, LaunchOptions sc) { + mRS.validate(); + mRS.validateObject(ain); + mRS.validateObject(aout); if (ain == null && aout == null) { throw new RSIllegalArgumentException( "At least one of ain or aout is required to be non-null."); @@ -187,6 +193,7 @@ public class Script extends BaseObj { */ public void bindAllocation(Allocation va, int slot) { mRS.validate(); + mRS.validateObject(va); if (va != null) { if (mRS.getApplicationContext().getApplicationInfo().targetSdkVersion >= 20) { final Type t = va.mType; @@ -263,6 +270,8 @@ public class Script extends BaseObj { * */ public void setVar(int index, BaseObj o) { + mRS.validate(); + mRS.validateObject(o); mRS.nScriptSetVarObj(getID(mRS), index, (o == null) ? 0 : o.getID(mRS)); } |