SF #3127633 Fix infinite loop in recursive typedef resolution.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12433 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f4c74bc500
commit
4f616b5942
5 changed files with 17 additions and 1 deletions
|
|
@ -107,7 +107,7 @@ static Typetab *global_scope = 0; /* The global scope
|
|||
static Hash *scopes = 0; /* Hash table containing fully qualified scopes */
|
||||
|
||||
/* Performance optimization */
|
||||
#define SWIG_TYPEDEF_RESOLVE_CACHE
|
||||
#define SWIG_TYPEDEF_RESOLVE_CACHE
|
||||
static Hash *typedef_resolve_cache = 0;
|
||||
static Hash *typedef_all_cache = 0;
|
||||
static Hash *typedef_qualified_cache = 0;
|
||||
|
|
@ -809,6 +809,7 @@ return_result:
|
|||
SwigType *SwigType_typedef_resolve_all(const SwigType *t) {
|
||||
SwigType *n;
|
||||
SwigType *r;
|
||||
int count = 0;
|
||||
|
||||
/* Check to see if the typedef resolve has been done before by checking the cache */
|
||||
if (!typedef_all_cache) {
|
||||
|
|
@ -824,6 +825,10 @@ SwigType *SwigType_typedef_resolve_all(const SwigType *t) {
|
|||
while ((n = SwigType_typedef_resolve(r))) {
|
||||
Delete(r);
|
||||
r = n;
|
||||
if (++count >= 512) {
|
||||
Swig_error(Getfile(t), Getline(t), "Recursive typedef detected resolving '%s' to '%s' to '%s' and so on...\n", SwigType_str(t, 0), SwigType_str(SwigType_typedef_resolve(t), 0), SwigType_str(SwigType_typedef_resolve(SwigType_typedef_resolve(t)), 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the typedef to the cache for next time it is looked up */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue