Add some sanity checks to resources iteration routine in PE module
Improve atom quality calculation

By avoiding bytes 0x00 and 0xFF at the beginning of the atom a 8x speedup was observed with a very large set of rules.
Avoid stack overflow

PE files can contain loops in the resources structure causing stack overflows while calling _pe_iterate_resources recursively.