mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 01:21:08 +00:00
Fix stack overflow.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17453 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6acd869d7b
commit
76b458f3e8
3 changed files with 132 additions and 126 deletions
|
@ -3,7 +3,11 @@
|
|||
* Source/NSString.m: nodeToObject() fix error in handling escape
|
||||
sequences in strings ... only treat a backslash specially when it
|
||||
is immediately followed by 'U' or 'u' and four hexadecimal digits.
|
||||
ensure data ia deallocated promptly.
|
||||
* Source/GSCompatibility.m: match changes to property list escapes
|
||||
* Source/Additions/GSXML.m: change ownership policy so that nodes
|
||||
are owned by theri parents, never by siblings ... prevent stack
|
||||
overflow deallocating nodes in long documents.
|
||||
* Tools/plist-0_9.dtd: document unicode escapes.
|
||||
|
||||
2003-08-02 Adam Fedor <fedor@gnu.org>
|
||||
|
|
|
@ -1340,7 +1340,7 @@ static NSMapTable *nodeNames = 0;
|
|||
{
|
||||
GSXMLNode *n = [GSXMLNode alloc];
|
||||
|
||||
n = [n _initFrom: ((xmlNodePtr)(lib))->next parent: self];
|
||||
n = [n _initFrom: ((xmlNodePtr)(lib))->next parent: _parent];
|
||||
return AUTORELEASE(n);
|
||||
}
|
||||
else
|
||||
|
@ -1367,7 +1367,7 @@ static NSMapTable *nodeNames = 0;
|
|||
{
|
||||
GSXMLNode *n = [GSXMLNode alloc];
|
||||
|
||||
n = [n _initFrom: ptr parent: self];
|
||||
n = [n _initFrom: ptr parent: _parent];
|
||||
return AUTORELEASE(n);
|
||||
}
|
||||
}
|
||||
|
@ -1476,7 +1476,7 @@ static NSMapTable *nodeNames = 0;
|
|||
{
|
||||
GSXMLNode *n = [GSXMLNode alloc];
|
||||
|
||||
n = [n _initFrom: ((xmlNodePtr)(lib))->prev parent: self];
|
||||
n = [n _initFrom: ((xmlNodePtr)(lib))->prev parent: _parent];
|
||||
return AUTORELEASE(n);
|
||||
}
|
||||
else
|
||||
|
@ -1501,7 +1501,7 @@ static NSMapTable *nodeNames = 0;
|
|||
{
|
||||
GSXMLNode *n = [GSXMLNode alloc];
|
||||
|
||||
n = [n _initFrom: ptr parent: self];
|
||||
n = [n _initFrom: ptr parent: _parent];
|
||||
return AUTORELEASE(n);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "GNUstepBase/preface.h"
|
||||
#include "Foundation/NSAutoreleasePool.h"
|
||||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSCalendarDate.h"
|
||||
#include "Foundation/NSArray.h"
|
||||
|
@ -4987,16 +4988,17 @@ elementNode(GSXMLNode* node)
|
|||
|
||||
static id
|
||||
nodeToObject(GSXMLNode* node)
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
id result = nil;
|
||||
|
||||
node = elementNode(node);
|
||||
if (node != nil)
|
||||
{
|
||||
NSString *name;
|
||||
NSString *content;
|
||||
GSXMLNode *children;
|
||||
|
||||
node = elementNode(node);
|
||||
if (node == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
name = [node name];
|
||||
children = [node firstChild];
|
||||
content = [children content];
|
||||
|
@ -5070,15 +5072,15 @@ nodeToObject(GSXMLNode* node)
|
|||
content = [NSString stringWithCharacters: buf length: len];
|
||||
}
|
||||
}
|
||||
return content;
|
||||
result = content;
|
||||
}
|
||||
else if ([name isEqualToString: @"true"])
|
||||
{
|
||||
return [NSNumber numberWithBool: YES];
|
||||
result = [NSNumber numberWithBool: YES];
|
||||
}
|
||||
else if ([name isEqualToString: @"false"])
|
||||
{
|
||||
return [NSNumber numberWithBool: NO];
|
||||
result = [NSNumber numberWithBool: NO];
|
||||
}
|
||||
else if ([name isEqualToString: @"integer"])
|
||||
{
|
||||
|
@ -5086,7 +5088,7 @@ nodeToObject(GSXMLNode* node)
|
|||
{
|
||||
content = @"0";
|
||||
}
|
||||
return [NSNumber numberWithInt: [content intValue]];
|
||||
result = [NSNumber numberWithInt: [content intValue]];
|
||||
}
|
||||
else if ([name isEqualToString: @"real"])
|
||||
{
|
||||
|
@ -5094,7 +5096,7 @@ nodeToObject(GSXMLNode* node)
|
|||
{
|
||||
content = @"0.0";
|
||||
}
|
||||
return [NSNumber numberWithDouble: [content doubleValue]];
|
||||
result = [NSNumber numberWithDouble: [content doubleValue]];
|
||||
}
|
||||
else if ([name isEqualToString: @"date"])
|
||||
{
|
||||
|
@ -5102,12 +5104,12 @@ nodeToObject(GSXMLNode* node)
|
|||
{
|
||||
content = @"";
|
||||
}
|
||||
return [NSCalendarDate dateWithString: content
|
||||
result = [NSCalendarDate dateWithString: content
|
||||
calendarFormat: @"%Y-%m-%d %H:%M:%S %z"];
|
||||
}
|
||||
else if ([name isEqualToString: @"data"])
|
||||
{
|
||||
return [GSMimeDocument decodeBase64String: content];
|
||||
result = [GSMimeDocument decodeBase64String: content];
|
||||
}
|
||||
// container class
|
||||
else if ([name isEqualToString: @"array"])
|
||||
|
@ -5120,9 +5122,9 @@ nodeToObject(GSXMLNode* node)
|
|||
|
||||
val = nodeToObject(children);
|
||||
[container addObject: val];
|
||||
children = elementNode([children next]);
|
||||
children = [children nextElement];
|
||||
}
|
||||
return container;
|
||||
result = container;
|
||||
}
|
||||
else if ([name isEqualToString: @"dict"])
|
||||
{
|
||||
|
@ -5134,17 +5136,17 @@ nodeToObject(GSXMLNode* node)
|
|||
id val;
|
||||
|
||||
key = nodeToObject(children);
|
||||
children = elementNode([children next]);
|
||||
children = [children nextElement];
|
||||
val = nodeToObject(children);
|
||||
children = elementNode([children next]);
|
||||
children = [children nextElement];
|
||||
[container setObject: val forKey: key];
|
||||
}
|
||||
return container;
|
||||
result = container;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
RETAIN(result);
|
||||
RELEASE(arp);
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue