bug-gnustep
[Top][All Lists]
Advanced

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

[bug #25400] NSString -stringByStandardizingPath fails on path ending in


From: Eric Wasylishen
Subject: [bug #25400] NSString -stringByStandardizingPath fails on path ending in /.
Date: Sat, 24 Jan 2009 20:58:11 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1

URL:
  <http://savannah.gnu.org/bugs/?25400>

                 Summary: NSString -stringByStandardizingPath fails on path
ending in /.
                 Project: GNUstep
            Submitted by: ericw
            Submitted on: Sat 24 Jan 2009 08:58:08 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Sample app: 

/*
 * Output: (GNUstep rev 27670)
 * : Uncaught exception NSRangeException, reason: in
deleteCharactersInRange:, range { 12, 2 } extends beyond size (13)
 * Aborted (core dumped)
 *
 * Output: (Mac OS X 10.5)
 * 2009-01-24 13:17:49.121 TestApp[658:813] Standardized path: /home/ericw      
 *
 */

#import <Foundation/Foundation.h>

int main(int argc, char *argv[])
{
        id pool = [[NSAutoreleasePool alloc] init];
        NSString *a = [@"/home/ericw/." stringByStandardizingPath];
        NSLog(@"Standardized path: %@", a);
        [pool release];
        return 0;
}

----------

The problem is in the section starting at line 4075 of NSString.m.
One fix which I think would work is adding the condition:

if (NSMaxRange(r) < l)

before doing "r.length++;"

It's not the cleanest, though.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25400>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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