OSX compatibility fixes for zero width space character and initialising an NSURL

with bad strings.
This commit is contained in:
Richard Frith-Macdonald 2018-01-26 12:53:47 +00:00
parent 0e12e226c9
commit 7045f84acc
21 changed files with 31196 additions and 30499 deletions

File diff suppressed because it is too large Load diff

View file

@ -811,6 +811,11 @@ static NSUInteger urlAlign;
*/
static const char *filepath = ";/?:@&=+$,[]#";
if (nil == aUrlString)
{
RELEASE(self);
return nil; // OSX behavior is to give up.
}
if ([aUrlString isKindOfClass: [NSString class]] == NO)
{
[NSException raise: NSInvalidArgumentException
@ -843,9 +848,20 @@ static NSUInteger urlAlign;
buf = _data = (parsedURL*)NSZoneMalloc(NSDefaultMallocZone(), size);
memset(buf, '\0', size);
start = end = ptr = (char*)&buf[1];
[_urlString getCString: start
maxLength: size
encoding: NSASCIIStringEncoding];
NS_DURING
{
[_urlString getCString: start
maxLength: size
encoding: NSASCIIStringEncoding];
}
NS_HANDLER
{
/* OSX behavior when given non-ascii text is to return nil.
*/
RELEASE(self);
return nil;
}
NS_ENDHANDLER
/*
* Parse the scheme if possible.