From 02acfb1242d126e17a295ff8078ef9a73201c7ca Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 21 Jul 2016 10:38:37 +1200 Subject: Fix netlib.utils.is_valid_host - Don't crash when passed an empty string. This translated into an actual core crash, discovered while fuzzing with afl. - Taking a slice of length one out of bytes returns an integer, so the check for trailing period in this function never worked on Python3. - Add unit tests. --- test/netlib/test_utils.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/netlib/test_utils.py') diff --git a/test/netlib/test_utils.py b/test/netlib/test_utils.py index eaa66f13..f6acec03 100644 --- a/test/netlib/test_utils.py +++ b/test/netlib/test_utils.py @@ -3,6 +3,13 @@ from netlib import utils, tutils +def test_is_valid_host(): + assert not utils.is_valid_host(b"") + assert utils.is_valid_host(b"one.two") + assert not utils.is_valid_host(b"one"*255) + assert utils.is_valid_host(b"one.two.") + + def test_bidi(): b = utils.BiDi(a=1, b=2) assert b.a == 1 -- cgit v1.2.3 From 33ffbc28ede02d9238473e0569a85ce0ede061e6 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 21 Jul 2016 15:41:43 +1200 Subject: console: share one ActionBar instance This fixes an issues where popping a view off the stack caused stale ActionBar contents to be displayed. --- test/netlib/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/netlib/test_utils.py') diff --git a/test/netlib/test_utils.py b/test/netlib/test_utils.py index f6acec03..9dcbffd8 100644 --- a/test/netlib/test_utils.py +++ b/test/netlib/test_utils.py @@ -6,7 +6,7 @@ from netlib import utils, tutils def test_is_valid_host(): assert not utils.is_valid_host(b"") assert utils.is_valid_host(b"one.two") - assert not utils.is_valid_host(b"one"*255) + assert not utils.is_valid_host(b"one" * 255) assert utils.is_valid_host(b"one.two.") -- cgit v1.2.3