Program: 21727
Project: 21727
Buggy source:
void removePackageLI(PackageParser.Package pkg,boolean chatty){
  if (chatty && Config.LOGD)   Log.d(TAG,"String_Node_Str" + pkg.applicationInfo.packageName);
synchronized (mPackages) {
    clearPackagePreferredActivitiesLP(pkg.packageName);
    mPackages.remove(pkg.applicationInfo.packageName);
    if (pkg.mPath != null) {
      mAppDirs.remove(pkg.mPath);
    }
    PackageSetting ps=(PackageSetting)pkg.mExtras;
    if (ps != null && ps.sharedUser != null) {
      if (false) {
        ps.sharedUser.packages.remove(ps);
        if (ps.sharedUser.packages.size() == 0) {
        }
      }
    }
    int N=pkg.providers.size();
    StringBuilder r=null;
    int i;
    for (i=0; i < N; i++) {
      PackageParser.Provider p=pkg.providers.get(i);
      mProvidersByComponent.remove(new ComponentName(p.info.packageName,p.info.name));
      if (p.info.authority == null) {
        continue;
      }
      String names[]=p.info.authority.split("String_Node_Str");
      for (int j=0; j < names.length; j++) {
        if (mProviders.get(names[j]) == p) {
          mProviders.remove(names[j]);
          if (chatty && Config.LOGD)           Log.d(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ p.info.name+ "String_Node_Str"+ p.info.isSyncable);
        }
      }
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(p.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.services.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Service s=pkg.services.get(i);
      mServices.removeService(s);
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(s.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.receivers.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.receivers.get(i);
      mReceivers.removeActivity(a,"String_Node_Str");
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.activities.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.activities.get(i);
      mActivities.removeActivity(a,"String_Node_Str");
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.permissions.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Permission p=pkg.permissions.get(i);
      boolean tree=false;
      BasePermission bp=mSettings.mPermissions.get(p.info.name);
      if (bp == null) {
        tree=true;
        bp=mSettings.mPermissionTrees.get(p.info.name);
      }
      if (bp != null && bp.perm == p) {
        bp.perm=null;
        if (chatty) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append(p.info.name);
        }
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.instrumentation.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Instrumentation a=pkg.instrumentation.get(i);
      mInstrumentation.remove(a.getComponentName());
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
  }
}

Fixed version (ground truth):
void removePackageLI(PackageParser.Package pkg,boolean chatty){
  if (chatty && Config.LOGD)   Log.d(TAG,"String_Node_Str" + pkg.applicationInfo.packageName);
synchronized (mPackages) {
    clearPackagePreferredActivitiesLP(pkg.packageName);
    mPackages.remove(pkg.applicationInfo.packageName);
    if (pkg.mPath != null) {
      mAppDirs.remove(pkg.mPath);
    }
    int N=pkg.providers.size();
    StringBuilder r=null;
    int i;
    for (i=0; i < N; i++) {
      PackageParser.Provider p=pkg.providers.get(i);
      mProvidersByComponent.remove(new ComponentName(p.info.packageName,p.info.name));
      if (p.info.authority == null) {
        continue;
      }
      String names[]=p.info.authority.split("String_Node_Str");
      for (int j=0; j < names.length; j++) {
        if (mProviders.get(names[j]) == p) {
          mProviders.remove(names[j]);
          if (chatty && Config.LOGD)           Log.d(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ p.info.name+ "String_Node_Str"+ p.info.isSyncable);
        }
      }
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(p.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.services.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Service s=pkg.services.get(i);
      mServices.removeService(s);
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(s.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.receivers.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.receivers.get(i);
      mReceivers.removeActivity(a,"String_Node_Str");
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.activities.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.activities.get(i);
      mActivities.removeActivity(a,"String_Node_Str");
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.permissions.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Permission p=pkg.permissions.get(i);
      boolean tree=false;
      BasePermission bp=mSettings.mPermissions.get(p.info.name);
      if (bp == null) {
        tree=true;
        bp=mSettings.mPermissionTrees.get(p.info.name);
      }
      if (bp != null && bp.perm == p) {
        bp.perm=null;
        if (chatty) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append(p.info.name);
        }
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.instrumentation.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Instrumentation a=pkg.instrumentation.get(i);
      mInstrumentation.remove(a.getComponentName());
      if (chatty) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
  }
}