Just a thought, but it might be a good idea to implement a sanity check in the algorithm. For example, as
the tree is being built or written to the file, keep a running count of the number characters. When the count
exceeds a threshold, terminate the algorithm and flag the file as being suspect. I don't know what that
threshold should be since some of those files are pretty big. network-manager-kde-tcz-tree is 93.7K
and there might be others that are larger still.