Program: 189894
Project: 189894
Buggy source:
public void mouseDragged(MouseEvent evt){
  if (model == null) {
    return;
  }
  double w=getWidth();
  currentMousePositionX=evt.getX();
  if (currentMousePositionX > (int)w) {
    currentMousePositionX=(int)w;
  }
  if (currentMousePositionX < 0) {
    currentMousePositionX=0;
  }
  int x=currentMousePositionX;
  int r=settings.selection.visibleHookWidth;
  if (currentState == TimelineState.IDLE) {
    if (inRange(x,(int)sf - 1,(int)sf + r + 1)) {
      highlightedComponent=HighlightedComponent.LEFT_HOOK;
      currentState=TimelineState.RESIZE_FROM;
    }
 else     if (inRange(x,(int)sf + r,(int)st - r)) {
      highlightedComponent=HighlightedComponent.CENTER_HOOK;
      currentState=TimelineState.MOVING;
    }
 else     if (inRange(x,(int)st - r - 1,(int)st + 1)) {
      highlightedComponent=HighlightedComponent.RIGHT_HOOK;
      currentState=TimelineState.RESIZE_TO;
    }
  }
  double delta=0;
  if (latestMousePositionX != null) {
    delta=x - latestMousePositionX;
  }
  latestMousePositionX=x;
  int s=settings.selection.minimalWidth;
switch (currentState) {
case RESIZE_FROM:
    if ((sf + delta) >= (st - s)) {
      sf=st - s;
    }
 else {
      if (sf + delta <= 0) {
        sf=0;
      }
 else {
        sf+=delta;
      }
    }
  break;
case RESIZE_TO:
if ((st + delta) <= (sf + s)) {
  st=sf + s;
}
 else {
  if ((st + delta >= w)) {
    st=w;
  }
 else {
    st+=delta;
  }
}
break;
case MOVING:
if ((sf + delta) < 0) {
st=(st - sf);
sf=0;
}
 else if ((st + delta) >= w) {
sf=w - (st - sf);
st=w;
}
 else {
sf+=delta;
st+=delta;
}
break;
}
if (w != 0) {
newfrom=sf * (1.0 / w);
newto=st * (1.0 / w);
}
this.repaint();
}

Fixed version (ground truth):
public void mouseDragged(MouseEvent evt){
  if (model == null) {
    return;
  }
  double w=getWidth();
  currentMousePositionX=evt.getX();
  if (currentMousePositionX > (int)w) {
    currentMousePositionX=(int)w;
  }
  if (currentMousePositionX < 0) {
    currentMousePositionX=0;
  }
  int x=currentMousePositionX;
  int r=settings.selection.visibleHookWidth;
  if (currentState == TimelineState.IDLE) {
    int position=inPosition(x,r);
switch (position) {
case LOC_RESIZE_FROM:
      highlightedComponent=HighlightedComponent.LEFT_HOOK;
    currentState=TimelineState.RESIZE_FROM;
  break;
case LOC_RESIZE_CENTER:
highlightedComponent=HighlightedComponent.CENTER_HOOK;
currentState=TimelineState.MOVING;
break;
case LOC_RESIZE_TO:
highlightedComponent=HighlightedComponent.RIGHT_HOOK;
currentState=TimelineState.RESIZE_TO;
break;
default :
break;
}
}
double delta=0;
if (latestMousePositionX != null) {
delta=x - latestMousePositionX;
}
latestMousePositionX=x;
int s=settings.selection.minimalWidth;
switch (currentState) {
case RESIZE_FROM:
if ((sf + delta) >= (st - s)) {
sf=st - s;
}
 else {
if (sf + delta <= 0) {
sf=0;
}
 else {
sf+=delta;
}
}
break;
case RESIZE_TO:
if ((st + delta) <= (sf + s)) {
st=sf + s;
}
 else {
if ((st + delta >= w)) {
st=w;
}
 else {
st+=delta;
}
}
break;
case MOVING:
if ((sf + delta) < 0) {
st=(st - sf);
sf=0;
}
 else if ((st + delta) >= w) {
sf=w - (st - sf);
st=w;
}
 else {
sf+=delta;
st+=delta;
}
break;
}
if (w != 0) {
newfrom=sf * (1.0 / w);
newto=st * (1.0 / w);
}
this.repaint();
}