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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitted by:  Eric Wasylishen <ericw>
Submitted on:  Sat 24 Jan 2009 08:58:08 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

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

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

Richard Frith-Macdonald <CaS>
Project 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>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 25 Jan 2009 08:42:09 AM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1