Program: 165254
Project: 165254
Buggy source:
private void extractPerms(PackageInfo info,Set<MyPermissionInfo> permSet,PackageInfo installedPkgInfo){
  final String[] strList=info.requestedPermissions;
  if (strList == null || strList.length == 0) {
    return;
  }
  final int[] flagsList=getRequestedPermissionFlags(info);
  for (int i=0; i < strList.length; i++) {
    String permName=strList[i];
    try {
      PermissionInfo tmpPermInfo=mPm.getPermissionInfo(permName,0);
      if (tmpPermInfo == null) {
        continue;
      }
      int existingIndex=-1;
      if (installedPkgInfo != null && installedPkgInfo.requestedPermissions != null) {
        for (int j=0; j < installedPkgInfo.requestedPermissions.length; j++) {
          if (permName.equals(installedPkgInfo.requestedPermissions[j])) {
            existingIndex=j;
            break;
          }
        }
      }
      int existingFlags=0;
      if (existingIndex >= 0) {
        final int[] instFlagsList=getRequestedPermissionFlags(installedPkgInfo);
        existingFlags=instFlagsList[existingIndex];
      }
      if (!isDisplayablePermission(tmpPermInfo,existingFlags)) {
        continue;
      }
      final String origGroupName=tmpPermInfo.group;
      String groupName=origGroupName;
      if (groupName == null) {
        groupName=tmpPermInfo.packageName;
        tmpPermInfo.group=groupName;
      }
      MyPermissionGroupInfo group=mPermGroups.get(groupName);
      if (group == null) {
        PermissionGroupInfo grp=null;
        if (origGroupName != null) {
          grp=mPm.getPermissionGroupInfo(origGroupName,0);
        }
        if (grp != null) {
          group=new MyPermissionGroupInfo(grp);
        }
 else {
          tmpPermInfo.group=tmpPermInfo.packageName;
          group=mPermGroups.get(tmpPermInfo.group);
          if (group == null) {
            group=new MyPermissionGroupInfo(tmpPermInfo);
          }
        }
        mPermGroups.put(tmpPermInfo.group,group);
      }
      final boolean newPerm=installedPkgInfo != null && (existingFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0;
      MyPermissionInfo myPerm=new MyPermissionInfo(tmpPermInfo);
      myPerm.mExistingReqFlags=existingFlags;
      myPerm.mNew=newPerm;
      permSet.add(myPerm);
    }
 catch (    NameNotFoundException e) {
      Log.i(TAG,"String_Node_Str" + permName);
    }
  }
}

Fixed version (ground truth):
private void extractPerms(PackageInfo info,Set<MyPermissionInfo> permSet,PackageInfo installedPkgInfo){
  final String[] strList=info.requestedPermissions;
  if (strList == null || strList.length == 0) {
    return;
  }
  for (  String permName : strList) {
    try {
      PermissionInfo tmpPermInfo=mPm.getPermissionInfo(permName,0);
      if (tmpPermInfo == null) {
        continue;
      }
      int existingIndex=-1;
      if (installedPkgInfo != null && installedPkgInfo.requestedPermissions != null) {
        for (int j=0; j < installedPkgInfo.requestedPermissions.length; j++) {
          if (permName.equals(installedPkgInfo.requestedPermissions[j])) {
            existingIndex=j;
            break;
          }
        }
      }
      int existingFlags=0;
      if (existingIndex >= 0) {
        final int[] instFlagsList=getRequestedPermissionFlags(installedPkgInfo);
        existingFlags=instFlagsList[existingIndex];
      }
      if (!isDisplayablePermission(tmpPermInfo,existingFlags)) {
        continue;
      }
      final String origGroupName=tmpPermInfo.group;
      String groupName=origGroupName;
      if (groupName == null) {
        groupName=tmpPermInfo.packageName;
        tmpPermInfo.group=groupName;
      }
      MyPermissionGroupInfo group=mPermGroups.get(groupName);
      if (group == null) {
        PermissionGroupInfo grp=null;
        if (origGroupName != null) {
          grp=mPm.getPermissionGroupInfo(origGroupName,0);
        }
        if (grp != null) {
          group=new MyPermissionGroupInfo(grp);
        }
 else {
          tmpPermInfo.group=tmpPermInfo.packageName;
          group=mPermGroups.get(tmpPermInfo.group);
          if (group == null) {
            group=new MyPermissionGroupInfo(tmpPermInfo);
          }
        }
        mPermGroups.put(tmpPermInfo.group,group);
      }
      final boolean newPerm=installedPkgInfo != null && (existingFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) == 0;
      MyPermissionInfo myPerm=new MyPermissionInfo(tmpPermInfo);
      myPerm.mExistingReqFlags=existingFlags;
      myPerm.mNew=newPerm;
      permSet.add(myPerm);
    }
 catch (    NameNotFoundException e) {
      Log.i(TAG,"String_Node_Str" + permName);
    }
  }
}