diff options
author | Ian Rogers <irogers@google.com> | 2013-08-15 10:26:54 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2013-08-19 15:13:34 -0700 |
commit | abd7be989a7509d6dd7325d505fa9926ed502355 (patch) | |
tree | b6dfd2d5f4ebff454c75fb435c438af56be78e29 /runtime/throw_location.cc | |
parent | 7571e8b761ebc2c923525e12ea9fcf07e62cb33e (diff) | |
download | art-abd7be989a7509d6dd7325d505fa9926ed502355.zip art-abd7be989a7509d6dd7325d505fa9926ed502355.tar.gz art-abd7be989a7509d6dd7325d505fa9926ed502355.tar.bz2 |
Prevent segvs in JNI.
A segv in JNI code (without CheckJNI) is hard to debug as we fail to see
stacks, pending exceptions.. Make JNI code robust to null arguments, but don't
go to the lengths that CheckJNI does in also sanity checking arguments, the
priority here is just to stop the VM from crashing.
Bug 10305723
Also, allow an unknown throw location not to crash exception dumping.
Found/useful for debugging bug 10331039.
(cherry picked from commit bc939663ccfbe0c648dd6a3670041510aca82420)
Change-Id: Id0203db7d9e320d45ae5ba25d2b63939c79e5c16
Diffstat (limited to 'runtime/throw_location.cc')
-rw-r--r-- | runtime/throw_location.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/throw_location.cc b/runtime/throw_location.cc index 6d1ca1b..e428511 100644 --- a/runtime/throw_location.cc +++ b/runtime/throw_location.cc @@ -25,8 +25,12 @@ namespace art { std::string ThrowLocation::Dump() const { - return StringPrintf("%s:%d", PrettyMethod(method_).c_str(), - MethodHelper(method_).GetLineNumFromDexPC(dex_pc_)); + if (method_ != NULL) { + return StringPrintf("%s:%d", PrettyMethod(method_).c_str(), + MethodHelper(method_).GetLineNumFromDexPC(dex_pc_)); + } else { + return "unknown throw location"; + } } void ThrowLocation::VisitRoots(RootVisitor* visitor, void* arg) { |