mirror of
https://github.com/revanced/smali.git
synced 2025-05-08 02:14:32 +02:00
Added the "RecursiveAnnotation" example, which shows a humerous example of an annotation that references itself recursively, causing a stack overflow.
git-svn-id: https://smali.googlecode.com/svn/trunk@68 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
cf396faa1a
commit
dbfce409d4
24
src/test/resources/examples/RecursiveAnnotation/Main.smali
Normal file
24
src/test/resources/examples/RecursiveAnnotation/Main.smali
Normal file
@ -0,0 +1,24 @@
|
||||
.class public LMain;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
;expected output (using the dalvik's default stack size)
|
||||
;@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=@RecursiveAnnotation(value=java.lang.StackOverflowError))))))))))))))))))))))))))))))
|
||||
|
||||
.method public static main([Ljava/lang/String;)V
|
||||
.registers 3
|
||||
|
||||
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
|
||||
|
||||
const-class v1, LMain;
|
||||
const-class v2, LRecursiveAnnotation;
|
||||
|
||||
invoke-virtual {v1, v2}, Ljava/lang/Class;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
|
||||
move-result-object v1
|
||||
|
||||
invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.annotation runtime LRecursiveAnnotation;
|
||||
.end annotation
|
@ -0,0 +1,18 @@
|
||||
.class public abstract interface annotation LRecursiveAnnotation;
|
||||
.super Ljava/lang/Object;
|
||||
.implements Ljava/lang/annotation/Annotation;
|
||||
|
||||
;this is a recursive annotation that has a default value of itself.
|
||||
;Trying to print .toString() on an instance of this annotation
|
||||
;will cause a stack overflow
|
||||
|
||||
.method public abstract value()LRecursiveAnnotation;
|
||||
.end method
|
||||
|
||||
.annotation system Ldalvik/annotation/AnnotationDefault;
|
||||
value = .subannotation LRecursiveAnnotation;
|
||||
value = .subannotation LRecursiveAnnotation;
|
||||
.end subannotation
|
||||
.end subannotation
|
||||
.end annotation
|
||||
|
Loading…
x
Reference in New Issue
Block a user