It is actually legal for a Report value to be a tuple -- the intention
is that this is a "file reference", and we make use of that in several
places to avoid needless copies in RAM. For example in data/apport:
info['CoreDump'] = (sys.stdin, True, core_size_limit, True)
or in data/kernel_crashdump:
pr['VmCoreLog'] = (os.fdopen(log_fd, 'rb'),)
So the problem is that __setitem__() also (erroneously) accepts lists,
it does not verify that it is actually a tuple:
if not (isinstance(v, CompressedValue) or hasattr(v, 'isalnum') or
(hasattr(v, '__getitem__') and (
len(v) == 1 or (len(v) >= 2 and v[1] in (True, False))) and
(hasattr(v[0], 'isalnum') or hasattr(v[0], 'read')))):
raise TypeError("value for key %s must be a string,
CompressedValue, or a file reference" % k)
It already does check the length and types of the arguments, though.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1596713
Title:
apport-cli crashes if a hook provides a python list which is a
directory w/o files
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1596713/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs