commit 4c3aad92ce78625e417b9afd42f614f72707b475 Author: Philipp Winter phw@nymity.ch Date: Tue Jan 28 10:51:23 2020 -0800
Make sure that ports don't end up being negative.
This fixes a bug that our CI system stumbled upon:
+./scripts/create_descriptors 200 --num-resistant-descs 100 Traceback (most recent call last): File "./scripts/create_descriptors", line 298, in <module> make_descriptors(args.num_descs, args.num_resistant_descs) File "./scripts/create_descriptors", line 266, in make_descriptors num_probing_resistant > 0) File "./scripts/create_descriptors", line 242, in create_extrainfo_desc }, signing_key=signing_key) File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/stem/descriptor/extrainfo_descriptor.py", line 944, in create return cls(cls.content(attr, exclude, sign, signing_key), validate = validate) File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/stem/descriptor/extrainfo_descriptor.py", line 865, in __init__ self._parse(entries, validate) File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/stem/descriptor/__init__.py", line 744, in _parse parser_for_line[keyword](self, entries) File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/stem/descriptor/extrainfo_descriptor.py", line 296, in _parse_transport_line raise ValueError('Transport line has a malformed port: transport %s' % value) ValueError: Transport line has a malformed port: transport obfs3 203.54.46.87:-2 --- scripts/create_descriptors | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/scripts/create_descriptors b/scripts/create_descriptors index 839a6ba..ab6ea2e 100755 --- a/scripts/create_descriptors +++ b/scripts/create_descriptors @@ -85,6 +85,10 @@ def get_transport_line(probing_resistant, addr, port): active probing attacks. """
+ # Make sure that we won't end up with a negative port. + if port <= 21: + port = 21 + transports = [] if probing_resistant: transports.append("obfs2 %s:%s" % (addr, port-10))