OSDN Git Service

Fix vtable corruption issue
authorAlex Light <allight@google.com>
Wed, 7 Sep 2016 19:04:20 +0000 (12:04 -0700)
committerAlex Light <allight@google.com>
Fri, 9 Sep 2016 20:09:03 +0000 (13:09 -0700)
commitb47a1cc17f53951b900e56bb68c58c972517cb07
tree233134cf5677e6a7a285ee95009bf36e72f6c96a
parent0e4a2f0d6b526d398b71a54395c3071a8e78e503
Fix vtable corruption issue

We were adding duplicate methods to the vtable in some cases where
default methods (and conflict methods) were used. This caused issues
where they were not correctly overridden in subclasses that implement
these methods directly. When overridden only one of the vtable entries
was updated meaning it was still possible to reach the overridden code
using a virtual call.

This change prevents the duplicate methods from being added to the
vtable in this circumstance. It also adds a debug check that ensures
that the vtable has no duplicates to prevent regressions.

Bug: 31280371

Test: mma test-art-host
Test: mma test-art-host-run-test-960-default-smali

Change-Id: I17d88fb8949c8d5d75b4de3c734fd98660b81e61
(cherry picked from commit 1f3925d4f067438d3689ef2736fd2af063c98668)
12 files changed:
runtime/class_linker.cc
test/960-default-smali/expected.txt
test/960-default-smali/src/Foo2.java [new file with mode: 0644]
test/960-default-smali/src/Foo3.java [new file with mode: 0644]
test/960-default-smali/src/N.java [new file with mode: 0644]
test/960-default-smali/src/O.java [new file with mode: 0644]
test/960-default-smali/src/P.java [new file with mode: 0644]
test/960-default-smali/src/Q.java [new file with mode: 0644]
test/960-default-smali/src/classes.xml
test/960-default-smali/src2/Foo.java [new file with mode: 0644]
test/960-default-smali/src2/Foo3.java [new file with mode: 0644]
test/utils/python/generate_java_main.py