Commit 775fa2c0 authored by Will Kamp's avatar Will Kamp

Add circlar reference detection to eliminate potential for infinite recursive loop.

parent 0b3a0a14
......@@ -197,7 +197,12 @@ class DepFile(File):
if self.dep_level == None:
if len(self.depends_on) == 0:
self.dep_level = 0
elif self.dep_level >= 1000000:
raise Exception("Probably run into a circular reference of file dependencies.")
else:
# set stupidly large value so can detect if the recusion below brings us back to
# this file in a circular reference, that would otherwise result in an infinite loop.
self.dep_level = 1000000
# recurse, to find the largest number of levels below.
self.dep_level = 1 + max([dep.get_dep_level() for dep in self.depends_on]);
return self.dep_level
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment