Program: 23629
Project: 23629
Buggy source:
private boolean parseProviderTags(Resources res,XmlPullParser parser,AttributeSet attrs,Provider outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestGrantUriPermission);
      PatternMatcher pa=null;
      String str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestGrantUriPermission_path);
      if (str != null) {
        pa=new PatternMatcher(str,PatternMatcher.PATTERN_LITERAL);
      }
      str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestGrantUriPermission_pathPrefix);
      if (str != null) {
        pa=new PatternMatcher(str,PatternMatcher.PATTERN_PREFIX);
      }
      str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestGrantUriPermission_pathPattern);
      if (str != null) {
        pa=new PatternMatcher(str,PatternMatcher.PATTERN_SIMPLE_GLOB);
      }
      sa.recycle();
      if (pa != null) {
        if (outInfo.info.uriPermissionPatterns == null) {
          outInfo.info.uriPermissionPatterns=new PatternMatcher[1];
          outInfo.info.uriPermissionPatterns[0]=pa;
        }
 else {
          final int N=outInfo.info.uriPermissionPatterns.length;
          PatternMatcher[] newp=new PatternMatcher[N + 1];
          System.arraycopy(outInfo.info.uriPermissionPatterns,0,newp,0,N);
          newp[N]=pa;
          outInfo.info.uriPermissionPatterns=newp;
        }
        outInfo.info.grantUriPermissions=true;
      }
 else {
        if (!RIGID_PARSER) {
          Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
          Log.w(TAG,"String_Node_Str");
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        outError[0]="String_Node_Str";
        return false;
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestPathPermission);
      PathPermission pa=null;
      String permission=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_permission);
      String readPermission=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_readPermission);
      if (readPermission == null) {
        readPermission=permission;
      }
      String writePermission=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_writePermission);
      if (writePermission == null) {
        writePermission=permission;
      }
      boolean havePerm=false;
      if (readPermission != null) {
        readPermission=readPermission.intern();
        havePerm=true;
      }
      if (writePermission != null) {
        writePermission=readPermission.intern();
        havePerm=true;
      }
      if (!havePerm) {
        if (!RIGID_PARSER) {
          Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
          Log.w(TAG,"String_Node_Str");
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        outError[0]="String_Node_Str";
        return false;
      }
      String path=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_path);
      if (path != null) {
        pa=new PathPermission(path,PatternMatcher.PATTERN_LITERAL,readPermission,writePermission);
      }
      path=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_pathPrefix);
      if (path != null) {
        pa=new PathPermission(path,PatternMatcher.PATTERN_PREFIX,readPermission,writePermission);
      }
      path=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_pathPattern);
      if (path != null) {
        pa=new PathPermission(path,PatternMatcher.PATTERN_SIMPLE_GLOB,readPermission,writePermission);
      }
      sa.recycle();
      if (pa != null) {
        if (outInfo.info.pathPermissions == null) {
          outInfo.info.pathPermissions=new PathPermission[1];
          outInfo.info.pathPermissions[0]=pa;
        }
 else {
          final int N=outInfo.info.pathPermissions.length;
          PathPermission[] newp=new PathPermission[N + 1];
          System.arraycopy(outInfo.info.pathPermissions,0,newp,0,N);
          newp[N]=pa;
          outInfo.info.pathPermissions=newp;
        }
      }
 else {
        if (!RIGID_PARSER) {
          Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
          Log.w(TAG,"String_Node_Str");
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        outError[0]="String_Node_Str";
        return false;
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
        Log.w(TAG,"String_Node_Str" + parser.getName());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + parser.getName();
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean parseProviderTags(Resources res,XmlPullParser parser,AttributeSet attrs,Provider outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestGrantUriPermission);
      PatternMatcher pa=null;
      String str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestGrantUriPermission_path);
      if (str != null) {
        pa=new PatternMatcher(str,PatternMatcher.PATTERN_LITERAL);
      }
      str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestGrantUriPermission_pathPrefix);
      if (str != null) {
        pa=new PatternMatcher(str,PatternMatcher.PATTERN_PREFIX);
      }
      str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestGrantUriPermission_pathPattern);
      if (str != null) {
        pa=new PatternMatcher(str,PatternMatcher.PATTERN_SIMPLE_GLOB);
      }
      sa.recycle();
      if (pa != null) {
        if (outInfo.info.uriPermissionPatterns == null) {
          outInfo.info.uriPermissionPatterns=new PatternMatcher[1];
          outInfo.info.uriPermissionPatterns[0]=pa;
        }
 else {
          final int N=outInfo.info.uriPermissionPatterns.length;
          PatternMatcher[] newp=new PatternMatcher[N + 1];
          System.arraycopy(outInfo.info.uriPermissionPatterns,0,newp,0,N);
          newp[N]=pa;
          outInfo.info.uriPermissionPatterns=newp;
        }
        outInfo.info.grantUriPermissions=true;
      }
 else {
        if (!RIGID_PARSER) {
          Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        outError[0]="String_Node_Str";
        return false;
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestPathPermission);
      PathPermission pa=null;
      String permission=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_permission);
      String readPermission=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_readPermission);
      if (readPermission == null) {
        readPermission=permission;
      }
      String writePermission=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_writePermission);
      if (writePermission == null) {
        writePermission=permission;
      }
      boolean havePerm=false;
      if (readPermission != null) {
        readPermission=readPermission.intern();
        havePerm=true;
      }
      if (writePermission != null) {
        writePermission=readPermission.intern();
        havePerm=true;
      }
      if (!havePerm) {
        if (!RIGID_PARSER) {
          Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        outError[0]="String_Node_Str";
        return false;
      }
      String path=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_path);
      if (path != null) {
        pa=new PathPermission(path,PatternMatcher.PATTERN_LITERAL,readPermission,writePermission);
      }
      path=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_pathPrefix);
      if (path != null) {
        pa=new PathPermission(path,PatternMatcher.PATTERN_PREFIX,readPermission,writePermission);
      }
      path=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestPathPermission_pathPattern);
      if (path != null) {
        pa=new PathPermission(path,PatternMatcher.PATTERN_SIMPLE_GLOB,readPermission,writePermission);
      }
      sa.recycle();
      if (pa != null) {
        if (outInfo.info.pathPermissions == null) {
          outInfo.info.pathPermissions=new PathPermission[1];
          outInfo.info.pathPermissions[0]=pa;
        }
 else {
          final int N=outInfo.info.pathPermissions.length;
          PathPermission[] newp=new PathPermission[N + 1];
          System.arraycopy(outInfo.info.pathPermissions,0,newp,0,N);
          newp[N]=pa;
          outInfo.info.pathPermissions=newp;
        }
      }
 else {
        if (!RIGID_PARSER) {
          Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        outError[0]="String_Node_Str";
        return false;
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + parser.getName();
      return false;
    }
  }
  return true;
}