Program: 72464
Project: 72464
Buggy source:
protected void validateBoxProperty(IStyle style,int maxWidth,int maxHeight){
  int leftMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_LEFT),maxWidth);
  int rightMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_RIGHT),maxWidth);
  int topMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_TOP),maxWidth);
  int bottomMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_BOTTOM),maxWidth);
  int leftPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_LEFT),maxWidth));
  int rightPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_RIGHT),maxWidth));
  int topPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_TOP),maxWidth));
  int bottomPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_BOTTOM),maxWidth));
  int leftBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_LEFT_WIDTH),0));
  int rightBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH),0));
  int topBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_TOP_WIDTH),0));
  int bottomBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH),0));
  int[] vs=new int[]{rightMargin,leftMargin,rightPadding,leftPadding,rightBorder,leftBorder};
  resolveBoxConflict(vs,maxWidth);
  int[] hs=new int[]{bottomMargin,topMargin,bottomPadding,topPadding,bottomBorder,topBorder};
  resolveBoxConflict(hs,maxHeight);
  style.setProperty(IStyle.STYLE_MARGIN_LEFT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[1]));
  style.setProperty(IStyle.STYLE_MARGIN_RIGHT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[0]));
  style.setProperty(IStyle.STYLE_MARGIN_TOP,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[1]));
  style.setProperty(IStyle.STYLE_MARGIN_BOTTOM,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[0]));
  style.setProperty(IStyle.STYLE_PADDING_LEFT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[3]));
  style.setProperty(IStyle.STYLE_PADDING_RIGHT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[2]));
  style.setProperty(IStyle.STYLE_PADDING_TOP,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[3]));
  style.setProperty(IStyle.STYLE_PADDING_BOTTOM,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[2]));
  style.setProperty(IStyle.STYLE_BORDER_LEFT_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[5]));
  style.setProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[4]));
  style.setProperty(IStyle.STYLE_BORDER_TOP_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[5]));
  style.setProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[4]));
}

Fixed version (ground truth):
protected void validateBoxProperty(IStyle style,int maxWidth,int maxHeight){
  int leftMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_LEFT),maxWidth);
  int rightMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_RIGHT),maxWidth);
  int topMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_TOP),maxWidth);
  int bottomMargin=getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_BOTTOM),maxWidth);
  int leftPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_LEFT),maxWidth));
  int rightPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_RIGHT),maxWidth));
  int topPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_TOP),maxWidth));
  int bottomPadding=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_BOTTOM),maxWidth));
  int leftBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_LEFT_WIDTH),0));
  int rightBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH),0));
  int topBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_TOP_WIDTH),0));
  int bottomBorder=Math.max(0,getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH),0));
  int[] vs=new int[]{rightMargin,leftMargin,rightPadding,leftPadding,rightBorder,leftBorder};
  resolveBoxConflict(vs,maxWidth);
  int[] hs=new int[]{bottomMargin,topMargin,bottomPadding,topPadding,bottomBorder,topBorder};
  style.setProperty(IStyle.STYLE_MARGIN_LEFT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[1]));
  style.setProperty(IStyle.STYLE_MARGIN_RIGHT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[0]));
  style.setProperty(IStyle.STYLE_MARGIN_TOP,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[1]));
  style.setProperty(IStyle.STYLE_MARGIN_BOTTOM,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[0]));
  style.setProperty(IStyle.STYLE_PADDING_LEFT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[3]));
  style.setProperty(IStyle.STYLE_PADDING_RIGHT,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[2]));
  style.setProperty(IStyle.STYLE_PADDING_TOP,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[3]));
  style.setProperty(IStyle.STYLE_PADDING_BOTTOM,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[2]));
  style.setProperty(IStyle.STYLE_BORDER_LEFT_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[5]));
  style.setProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,vs[4]));
  style.setProperty(IStyle.STYLE_BORDER_TOP_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[5]));
  style.setProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH,new FloatValue(CSSPrimitiveValue.CSS_NUMBER,hs[4]));
}