1

I get the following dalvikvm verifier error:

Line 1041: W/dalvikvm( 2610): VFY: register1 v5 type 13, wanted 5
Line 1042: W/dalvikvm( 2610): VFY:  rejecting opcode 0x70 at 0x0032
Line 1043: W/dalvikvm( 2610): VFY:  rejected Lcom/cleanmaster/notification/aj;.b 

Smali code:

.method private b(Lcom/cleanmaster/notification/normal/NotificationSetting;Lcom/cleanmaster/notification/normal/o;Landroid/widget/RemoteViews;)V
.registers 11
.prologue
const/4 v5, 0x1
.line 126
iget-object v0, p2, Lcom/cleanmaster/notification/normal/o;->s:Landroid/content/Intent;
if-eqz v0, :cond_c
.line 127
iget-object v0, p2, Lcom/cleanmaster/notification/normal/o;->s:Landroid/content/Intent;
.line 128
const-string v1, "notify_style_type"
.line 129
invoke-static {v5}, Ljava/lang/Byte;->valueOf(B)Ljava/lang/Byte;
move-result-object v5
const-string v6, "putExtra(Ljava/lang/String;B)Landroid/content/Intent;"
invoke-static {v6, v0, v1, v5}, La;->c(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
invoke-virtual {v5}, Ljava/lang/Byte;->byteValue()B
move-result v5
:cond_c
.line 130
invoke-static {}, Lcom/keniu/security/c;->a()Landroid/content/Context;
move-result-object v1
.line 131
const-string v0, "notification"
.line 132
const-string v6, "getSystemService(Ljava/lang/String;)Ljava/lang/Object;"
invoke-static {v6, v1, v0}, Lb;->a(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v6
check-cast v6, Ljava/lang/Object;
move-object v0, v6
check-cast v0, Landroid/app/NotificationManager;
iget-boolean v2, p1, Lcom/cleanmaster/notification/normal/NotificationSetting;->i:Z
iget-boolean v3, p1, Lcom/cleanmaster/notification/normal/NotificationSetting;->o:Z
.line 133
invoke-direct {p0, v1, p2, v2, v3}, Lcom/cleanmaster/notification/aj;->a(Landroid/content/Context;Lcom/cleanmaster/notification/normal/o;ZZ)Landroid/app/Notification;
move-result-object v2
iget v3, p2, Lcom/cleanmaster/notification/normal/o;->d:I
const/4 v4, 0x0
.line 134
invoke-direct {p0, v3, v4, v5}, Lcom/cleanmaster/notification/aj;->a(IZZ)I

It looks to me like the last invoke-direct parameter v5 is a problem. Somehow dalvik things its not a primitive type and therefore cannot be cast to boolean. Altough there is a:

invoke-virtual {v5}, Ljava/lang/Byte;->byteValue()B
move-result v5

Is there a check-cast missing?

joe-jeff
  • 324
  • 1
  • 9
  • 27

1 Answers1

3

Opcode 0x70 is invoke-direct. The only invoke-direct instruction that references v5 is the last one: invoke-direct {p0, v3, v4, v5}, Lcom/cleanmaster/notification/aj;->a(IZZ)I. It appears that v5 is being set from the method you mention, but it is a byte (B), while this method expects a boolean (Z)

In order to diagnose this sort of issue yourself, you can run baksmali on the problematic dex file with the -r option, which adds comments in the disassembly related to the types of registers at any given point.

Another useful option is -f, which adds comments with the instruction offsets, so you can identify exactly which instruction the dalvik verification error is for.

e.g. rejecting opcode 0x70 at 0x0032 - so you would look for the instruction at offset 0x32

baksmali classes.dex -o out -f -r

And finally, in order to determine the actual types that the error mentions, you can look at the enum at https://android.googlesource.com/platform/dalvik/+/kitkat-mr2.2-release/vm/analysis/CodeVerify.h#59

e.g. for W/dalvikvm( 2610): VFY: register1 v5 type 13, wanted 5: type 13 is byte, while type 5 is boolean.

JesusFreke
  • 19,784
  • 5
  • 65
  • 68