Open nachobacanful opened 4 years ago
replace +
for format()
Fix at uniq() in intance:
https://github.com/CYBEX-P/tahoe/blob/1e2018550b3c4661543705129dabfcc4842cfa6d/tahoe/instance.py#L133
fix at uniq() in Events:
https://github.com/CYBEX-P/tahoe/blob/1e2018550b3c4661543705129dabfcc4842cfa6d/tahoe/instance.py#L230
When executing the following we get the following traceback
As shown in the error the problem is the following:
where
malicious
is of typebool
.Attribute()
then stores value inself.data
.Attribute
inherits fromInstance
.Instance
has auniq()
method ,when this method its call it tries to generate a string using python+
operator, this fails if operand are not strings. Problem A:Canonical only supports dict, list, and str, and not bool. , if unsupported type is inputted then it just returns it. this causes problems, generating problem B. Problem B:
we concatenate with the
+
operator, therefore all operand must of of typestr
, python will not do conversion if one of the operand is not a string.Solution:
using
format()
will force all operand to be converted to str, using__repr__()
as long as its available. if conversion function not available then it will fail, but this is not normal. Sol 2: supportbool
incanonical()
, even though this works this will cause the same problems foruniq()
if a new unsupported type is passed into canonical. Therefore i recommend both fixes.