bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix, NSLayoutManager


From: Georg Fleischmann
Subject: Re: Fix, NSLayoutManager
Date: Sun, 14 Mar 2004 00:50:29 GMT

Hi Fred,

> 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:

With casts like this it works:

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

The attached patch also works for the current CVS version.

Georg


*** gui/Source/NSLayoutManager.m.old    2004-03-14 01:15:46.000000000 +0100
--- gui/Source/NSLayoutManager.m        2004-03-14 01:41:56.000000000 +0100
***************
*** 1798,1804 ****

    if (layout_char > r.location)
      {
!       if (layout_char >= r.location + r.length)
        layout_char += lengthChange;
        else
        {
--- 1798,1804 ----

    if (layout_char > r.location)
      {
!       if ((int)layout_char + lengthChange >= (int)r.location)
        layout_char += lengthChange;
        else
        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]