Inside vardbapi.aux_get(), do more validation on the cache data to
authorZac Medico <zmedico@gentoo.org>
Tue, 20 May 2008 01:14:43 +0000 (01:14 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 20 May 2008 01:14:43 +0000 (01:14 -0000)
ensure it contains the expected data types. (trunk r10373)

svn path=/main/branches/2.1.2/; revision=10374

pym/portage.py

index 02e31965a3491bc2b79163d32c56a0485685d27c..85c65da2423e628cbe256cb7f75f39daaddd0ffc 100644 (file)
@@ -6902,6 +6902,15 @@ class vardbapi(dbapi):
                cache_incomplete = False
                cache_mtime = None
                metadata = None
+               if pkg_data is not None:
+                       if not isinstance(pkg_data, tuple) or len(pkg_data) != 2:
+                               pkg_data = None
+                       else:
+                               cache_mtime, metadata = pkg_data
+                               if not isinstance(cache_mtime, (long, int)) or \
+                                       not isinstance(metadata, dict):
+                                       pkg_data = None
+
                if pkg_data:
                        cache_mtime, metadata = pkg_data
                        cache_valid = cache_mtime == mydir_mtime