Restrict AVD and VD parsing to the current element instead of the whole document am: 1f859716a8

am: 897f5ca748

Change-Id: Ifc946e58e0455dac385f34a92e4181144a36edd8
This commit is contained in:
Doris Liu
2016-10-06 20:43:07 +00:00
committed by android-build-merger
2 changed files with 10 additions and 2 deletions

View File

@@ -455,7 +455,11 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
int eventType = parser.getEventType();
float pathErrorScale = 1;
while (eventType != XmlPullParser.END_DOCUMENT) {
final int innerDepth = parser.getDepth() + 1;
// Parse everything until the end of the animated-vector element.
while (eventType != XmlPullParser.END_DOCUMENT
&& (parser.getDepth() >= innerDepth || eventType != XmlPullParser.END_TAG)) {
if (eventType == XmlPullParser.START_TAG) {
final String tagName = parser.getName();
if (ANIMATED_VECTOR.equals(tagName)) {

View File

@@ -744,7 +744,11 @@ public class VectorDrawable extends Drawable {
groupStack.push(state.mRootGroup);
int eventType = parser.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
final int innerDepth = parser.getDepth() + 1;
// Parse everything until the end of the vector element.
while (eventType != XmlPullParser.END_DOCUMENT
&& (parser.getDepth() >= innerDepth || eventType != XmlPullParser.END_TAG)) {
if (eventType == XmlPullParser.START_TAG) {
final String tagName = parser.getName();
final VGroup currentGroup = groupStack.peek();