summaryrefslogtreecommitdiffstats
path: root/src/dex_verifier.cc
blob: 53bc3059e9137734794fb186e3b244c5ae242019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2011 Google Inc. All Rights Reserved.

#include "src/dex_verifier.h"

#include <iostream>

#include "logging.h"
#include "stringpiece.h"

namespace art {

bool DexVerify::VerifyClass(Class* klass) {
  if (klass->IsVerified()) {
    return true;
  }
  for (size_t i = 0; i < klass->NumDirectMethods(); ++i) {
    Method* method = klass->GetDirectMethod(i);
    if (!VerifyMethod(method)) {
        LOG(ERROR) << "Verifier rejected class " << klass->GetDescriptor();
      return false;
    }
  }
  for (size_t i = 0; i < klass->NumVirtualMethods(); ++i) {
    Method* method = klass->GetVirtualMethod(i);
    if (!VerifyMethod(method)) {
        LOG(ERROR) << "Verifier rejected class " << klass->GetDescriptor();
      return false;
    }
  }
  return true;
}

bool DexVerify::VerifyMethod(Method* method) {
  return true;  // TODO
}

}  // namespace art