From: Zac Medico Date: Wed, 21 Nov 2012 04:38:32 +0000 (-0800) Subject: flat_hash.__iter__: validate keys X-Git-Tag: v2.2.0_alpha143~27 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2694610b1fcd2818e203936bf663c9c44f4e6ca7;p=portage.git flat_hash.__iter__: validate keys --- diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index 2eae9f634..b71e118d5 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -13,6 +13,8 @@ from portage import os from portage import _encodings from portage import _unicode_decode from portage import _unicode_encode +from portage.exception import InvalidData +from portage.versions import _pkg_str if sys.hexversion >= 0x3000000: long = int @@ -135,8 +137,6 @@ class database(fs_template.FsBased): del e continue for l in dir_list: - if l.endswith(".cpickle"): - continue p = os.path.join(dir_path, l) try: st = os.lstat(p) @@ -151,7 +151,11 @@ class database(fs_template.FsBased): if depth < 1: dirs.append((depth+1, p)) continue - yield p[len_base+1:] + + try: + yield _pkg_str(p[len_base+1:]) + except InvalidData: + continue class md5_database(database):