diff options
author | Andreas Gampe <agampe@google.com> | 2015-08-12 10:48:12 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-08-12 16:54:23 -0700 |
commit | e682a0250702c65a668e39eefdd1c49cfea5f388 (patch) | |
tree | eb5e67e3957f63dbde2c8836474545992c06c6f8 /test/800-smali/smali/b_20843113.smali | |
parent | 6aec9daecf37fcf02e47ffa7c8faa8a3de2dc412 (diff) | |
download | android_art-e682a0250702c65a668e39eefdd1c49cfea5f388.tar.gz android_art-e682a0250702c65a668e39eefdd1c49cfea5f388.tar.bz2 android_art-e682a0250702c65a668e39eefdd1c49cfea5f388.zip |
ART: Change UninitializedThis tracking in the verifier
Only relying on register types is error-prone. For example, we may
inadvertently reject correct code when the constructor terminates
abnormally.
Bug: 20843113
(cherry picked from commit f10b6e109bfb595b6752d1b59db680694ac1684d)
(cherry picked from commit af31802e5b74f5b9b8d3aadbaaf48cfde14ff7d1)
Change-Id: I8826cd167780df25a6166740f183d216483fa550
Diffstat (limited to 'test/800-smali/smali/b_20843113.smali')
-rw-r--r-- | test/800-smali/smali/b_20843113.smali | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/800-smali/smali/b_20843113.smali b/test/800-smali/smali/b_20843113.smali new file mode 100644 index 0000000000..ab3dc4157b --- /dev/null +++ b/test/800-smali/smali/b_20843113.smali @@ -0,0 +1,34 @@ +.class public LB20843113; +.super Ljava/lang/Object; + + +.method public constructor <init>(I)V +.registers 2 + +:Label1 + # An instruction that may throw, so as to pass UninitializedThis to the handler + div-int v1, v1, v1 + + # Call the super-constructor + invoke-direct {v0}, Ljava/lang/Object;-><init>()V + + # Return normally. + return-void + +:Label2 + + +:Handler + move-exception v0 # Overwrite the (last) "this" register. This should be + # allowed as we will terminate abnormally below. + + throw v0 # Terminate abnormally + +.catchall {:Label1 .. :Label2} :Handler +.end method + +# Just a dummy. +.method public static run()V +.registers 1 + return-void +.end method |