Program: 70743
Project: 70743
Buggy source:
public void processSelection(GLAutoDrawable drawable){
  GL2GL3 gl=myGl;
  GLSupport.checkAndPrintGLError(gl);
  int w=myViewW;
  int h=myViewH;
  fbo.deactivate(gl);
  ByteBuffer pixels=fbo.getPixels(gl,GL.GL_RGBA);
  fbo.dispose(gl);
  fbo=null;
  myViewer.setLightingEnabled(true);
  myViewer.setBackgroundColor(savedBackgroundColor[0],savedBackgroundColor[1],savedBackgroundColor[2],savedBackgroundColor[3]);
  if (savedBlend) {
    gl.glEnable(GL.GL_BLEND);
  }
  if (savedMulti) {
    gl.glEnable(GL.GL_MULTISAMPLE);
  }
  myViewer.setViewport(gl,savedViewport[0],savedViewport[1],savedViewport[2],savedViewport[3]);
  myViewer.clearPickMatrix();
  if (!myMaxQStack.isEmpty()) {
    throw new IllegalStateException("String_Node_Str");
  }
  HitRecord[] hits=null;
  boolean badIdWarningIssued=false;
  for (int i=0; i < w; i++) {
    for (int j=0; j < h; j++) {
      int r=0xff & pixels.get();
      int g=0xff & pixels.get();
      int b=0xff & pixels.get();
      int a=0xff & pixels.get();
      int lcolorId=a;
      lcolorId=0;
      lcolorId<<=8;
      lcolorId+=b;
      lcolorId<<=8;
      lcolorId+=g;
      lcolorId<<=8;
      lcolorId+=r;
      int colorId=(int)(lcolorId & (0xFFFFFFFF));
      if (colorId != 0) {
        int id=colorId / ID_STEP - 1 - ID_OFFSET;
        if (id < 0 || id >= myTotalMaxQ) {
          if (!badIdWarningIssued) {
            System.out.printf("String_Node_Str" + "String_Node_Str",id);
            badIdWarningIssued=true;
          }
        }
 else {
          if (hits == null) {
            hits=new HitRecord[myTotalMaxQ];
          }
          HitRecord rec=hits[id];
          if (rec == null) {
            rec=new HitRecord(0);
            hits[id]=rec;
          }
          rec.size++;
        }
      }
    }
  }
  BufferUtilities.freeDirectBuffer(pixels);
  myViewer.selectionEvent.setSelectedObjects(null);
  if (hits == null) {
    myViewer.selectionEvent.setSelectedObjects(null);
  }
 else {
    int qid=0;
    LinkedList<HitRecord> records=new LinkedList<HitRecord>();
    Iterator<IsRenderable> it=myViewer.renderIterator();
    while (it.hasNext()) {
      IsRenderable r=it.next();
      if (r instanceof IsSelectable) {
        IsSelectable s=(IsSelectable)r;
        int numq=s.numSelectionQueriesNeeded();
        int nums=(numq >= 0 ? numq : 1);
        if (s.isSelectable()) {
          for (int i=0; i < nums; i++) {
            HitRecord rec;
            if ((rec=hits[qid + i]) != null) {
              if (numq < 0) {
                rec.objs.add(s);
              }
 else {
                s.getSelection(rec.objs,i);
              }
              if (rec.objs.size() > 0) {
                records.add(rec);
              }
            }
          }
        }
        qid+=nums;
      }
    }
    Collections.sort(records);
    ArrayList<LinkedList<?>> selObjs=new ArrayList<>(records.size());
    for (int i=0; i < records.size(); i++) {
      selObjs.add(records.get(i).objs);
    }
    myViewer.selectionEvent.setSelectedObjects(selObjs);
  }
  ViewerSelectionListener[] listeners=myViewer.getSelectionListeners();
  for (int i=0; i < listeners.length; i++) {
    listeners[i].itemsSelected(myViewer.selectionEvent);
  }
  myViewer.repaint();
}

Fixed version (ground truth):
public void processSelection(GLAutoDrawable drawable){
  GL2GL3 gl=myGl;
  GLSupport.checkAndPrintGLError(gl);
  int w=myViewW;
  int h=myViewH;
  fbo.deactivate(gl);
  ByteBuffer pixels=fbo.getPixels(gl,GL.GL_RGBA);
  fbo.dispose(gl);
  fbo=null;
  myViewer.setLightingEnabled(true);
  myViewer.setBackgroundColor(savedBackgroundColor[0],savedBackgroundColor[1],savedBackgroundColor[2],savedBackgroundColor[3]);
  if (savedBlend) {
    gl.glEnable(GL.GL_BLEND);
  }
  if (savedMulti) {
    gl.glEnable(GL.GL_MULTISAMPLE);
  }
  myViewer.setColor(savedColor);
  myViewer.setViewport(gl,savedViewport[0],savedViewport[1],savedViewport[2],savedViewport[3]);
  myViewer.clearPickMatrix();
  if (!myMaxQStack.isEmpty()) {
    throw new IllegalStateException("String_Node_Str");
  }
  HitRecord[] hits=null;
  boolean badIdWarningIssued=false;
  for (int i=0; i < w; i++) {
    for (int j=0; j < h; j++) {
      int r=0xff & pixels.get();
      int g=0xff & pixels.get();
      int b=0xff & pixels.get();
      int a=0xff & pixels.get();
      int lcolorId=a;
      lcolorId=0;
      lcolorId<<=8;
      lcolorId+=b;
      lcolorId<<=8;
      lcolorId+=g;
      lcolorId<<=8;
      lcolorId+=r;
      int colorId=(int)(lcolorId & (0xFFFFFFFF));
      if (colorId != 0) {
        int id=colorId / ID_STEP - 1 - ID_OFFSET;
        if (id < 0 || id >= myTotalMaxQ) {
          if (!badIdWarningIssued) {
            System.out.printf("String_Node_Str" + "String_Node_Str",id);
            badIdWarningIssued=true;
          }
        }
 else {
          if (hits == null) {
            hits=new HitRecord[myTotalMaxQ];
          }
          HitRecord rec=hits[id];
          if (rec == null) {
            rec=new HitRecord(0);
            hits[id]=rec;
          }
          rec.size++;
        }
      }
    }
  }
  BufferUtilities.freeDirectBuffer(pixels);
  myViewer.selectionEvent.setSelectedObjects(null);
  if (hits == null) {
    myViewer.selectionEvent.setSelectedObjects(null);
  }
 else {
    int qid=0;
    LinkedList<HitRecord> records=new LinkedList<HitRecord>();
    Iterator<IsRenderable> it=myViewer.renderIterator();
    while (it.hasNext()) {
      IsRenderable r=it.next();
      if (r instanceof IsSelectable) {
        IsSelectable s=(IsSelectable)r;
        int numq=s.numSelectionQueriesNeeded();
        int nums=(numq >= 0 ? numq : 1);
        if (s.isSelectable()) {
          for (int i=0; i < nums; i++) {
            HitRecord rec;
            if ((rec=hits[qid + i]) != null) {
              if (numq < 0) {
                rec.objs.add(s);
              }
 else {
                s.getSelection(rec.objs,i);
              }
              if (rec.objs.size() > 0) {
                records.add(rec);
              }
            }
          }
        }
        qid+=nums;
      }
    }
    Collections.sort(records);
    ArrayList<LinkedList<?>> selObjs=new ArrayList<>(records.size());
    for (int i=0; i < records.size(); i++) {
      selObjs.add(records.get(i).objs);
    }
    myViewer.selectionEvent.setSelectedObjects(selObjs);
  }
  ViewerSelectionListener[] listeners=myViewer.getSelectionListeners();
  for (int i=0; i < listeners.length; i++) {
    listeners[i].itemsSelected(myViewer.selectionEvent);
  }
  myViewer.repaint();
}