Georg Fleischmann wrote:
Hi,

here is a little patch for the NSLayoutManager fixing a problem with layout_char. layout_char is unsigned but may become "negative", thus flipping over to huge positive. The huge positive value then is not sattisfying the '<' comparison.

Georg


2004-03-10 Georg Fleischmann * gui/Source/NSLayoutManager.m [NSLayoutManager textStorage:...]: keep (unsigned) layout_char in legal range, in case it becomes < 0



*** gui/Source/NSLayoutManager.m.old    2004-02-15 19:23:13.000000000 +0100
--- gui/Source/NSLayoutManager.m        2004-03-10 19:30:38.000000000 +0100
***************
*** 1800,1806 ****
    if (layout_char > r.location)
      {
        layout_char += lengthChange;
!       if (layout_char < r.location)
          layout_char = r.location;
      }

--- 1800,1806 ----
if (layout_char > r.location)
{
layout_char += lengthChange;
! if (layout_char < r.location || layout_char > r.location + r.length)
layout_char = r.location;
}

I think you did spot a real problem here, but your solution just doesn't look right. An unsigned number never should be allowed to wrap around. What about a check like this:


    if (layout_char > r.location)
      {
        if (layout_char + lengthChange < r.location)
          {
            layout_char = r.location;
          }
        else
          {
            layout_char += lengthChange;
          }
      }




_______________________________________________ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to