--- nsMathMLChar.cpp.orig	2006-02-22 18:15:26.000000000 -0500
+++ nsMathMLChar.cpp	2006-10-04 22:26:16.000000000 -0400
@@ -2195,13 +2195,15 @@
     aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
     nsMathMLFrame::GetRuleThickness(fm, overlap);
     overlap = 2 * PR_MAX(overlap, onePixel);
-    while (overlap > onePixel && bmdata[3].ascent + bmdata[3].descent <= 2*overlap)
+    while (overlap > 0 && bmdata[3].ascent + bmdata[3].descent <= 2*overlap + onePixel)
       overlap -= onePixel;
 
-    // to protect against gaps, pretend the glue is smaller than 
-    // it says to allow a small overlap when adjoining it
-    bmdata[3].ascent -= overlap;
-    bmdata[3].descent -= overlap;
+    if (overlap > 0) {
+      // to protect against gaps, pretend the glue is smaller than 
+      // it says to allow a small overlap when adjoining it
+      bmdata[3].ascent -= overlap;
+      bmdata[3].descent -= overlap;
+    }
 
     for (i = 0; i < 2; i++) {
       PRInt32 count = 0;
@@ -2383,13 +2385,15 @@
     aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
     nsMathMLFrame::GetRuleThickness(fm, overlap);
     overlap = 2 * PR_MAX(overlap, onePixel);
-    while (overlap > onePixel && bmdata[3].rightBearing - bmdata[3].leftBearing <= 2*overlap)
+    while (overlap > 0 && bmdata[3].rightBearing - bmdata[3].leftBearing <= 2*overlap + onePixel)
       overlap -= onePixel;
 
-    // to protect against gaps, pretend the glue is smaller than 
-    // it says to allow a small overlap when adjoining it
-    bmdata[3].leftBearing += overlap;
-    bmdata[3].rightBearing -= overlap;
+    if (overlap > 0) {
+      // to protect against gaps, pretend the glue is smaller than 
+      // it says to allow a small overlap when adjoining it
+      bmdata[3].leftBearing += overlap;
+      bmdata[3].rightBearing -= overlap;
+    }
 
     for (i = 0; i < 2; i++) {
       PRInt32 count = 0;
