From 564233098c6a8c26c9b3eafa6ff02de42631d510 Mon Sep 17 00:00:00 2001
From: gpotter2 <gabriel@potter.fr>
Date: Sun, 10 Sep 2017 12:41:56 +0200
Subject: [PATCH] Reduce coverage randomness: tls+TEX

---
 test/regression.uts | 14 ++++++++++++++
 test/tls.uts        |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/test/regression.uts b/test/regression.uts
index c0ed1b31..fe135ea8 100644
--- a/test/regression.uts
+++ b/test/regression.uts
@@ -333,6 +333,20 @@ assert(ret == ("<span class=prompt>&gt;&gt;&gt; </span>IP().src\n'127.0.0.1'\n",
 ret = autorun_get_latex_interactive_session("IP().src")
 assert(ret == ("\\textcolor{blue}{{\\tt\\char62}{\\tt\\char62}{\\tt\\char62} }IP().src\n'127.0.0.1'\n", '127.0.0.1'))
 
+= Test utility TEX functions
+
+assert tex_escape("{scapy}\\^$~#_&%|><") == "{\\tt\\char123}scapy{\\tt\\char125}{\\tt\\char92}\\^{}\\${\\tt\\char126}\\#\\_\\&\\%{\\tt\\char124}{\\tt\\char62}{\\tt\\char60}"
+
+a = colgen(1, 2, 3)
+assert a.next() == (1, 2, 2)
+assert a.next() == (1, 3, 3)
+assert a.next() == (2, 2, 1)
+assert a.next() == (2, 3, 2)
+assert a.next() == (2, 1, 3)
+assert a.next() == (3, 3, 1)
+assert a.next() == (3, 1, 2)
+assert a.next() == (3, 2, 3)
+
 = Test config file functions
 
 saved_conf_verb = conf.verb
diff --git a/test/tls.uts b/test/tls.uts
index 8b672285..09f285c7 100644
--- a/test/tls.uts
+++ b/test/tls.uts
@@ -968,6 +968,10 @@ assert(not t7.pad and not t7.padlen)
 assert(isinstance(t7.msg[0], _TLSEncryptedContent))
 len(t7.msg[0].load) == 478
 
+= Reading TLS msg dissect - Wrong data
+from scapy.layers.tls.record import _TLSMsgListField
+assert isinstance(_TLSMsgListField.m2i(_TLSMsgListField("", []), TLS(type=0), '\x00\x03\x03\x00\x03abc'), Raw)
+
 
 ###############################################################################
 ################## Reading TLS vulnerable test session ########################
-- 
GitLab