bugGNUstep - Bugs: bug #25400, NSString...

Group
 
 

bug #25400: NSString -stringByStandardizingPath fails on path ending in /.

Submitter:  Eric Wasylishen <ericw>
Submitted:  Sat 24 Jan 2009 08:58:08 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 25 Jan 2009 08:42:09 AM UTC, comment #1: 

Thanks ... I added a fix for that in svn.

Richard Frith-Macdonald <CaS>
Group Member
Sat 24 Jan 2009 08:58:08 PM UTC, original submission:  

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.

Eric Wasylishen <ericw>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by ericw (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-01-25 CaS StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code