summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2016-01-16 21:33:58 +0900
committerLorenzo Colitti <lorenzo@google.com>2016-01-19 05:55:16 +0900
commit2c96358e57d689833af77ec0c13831a9ae1b27b8 (patch)
tree1497c090db72e134e65b44651b8f49d6091dd167 /tests
parentdfa6374100c934a21fdfcae7a8be9359b9c3e72c (diff)
downloadextras-2c96358e57d689833af77ec0c13831a9ae1b27b8.tar.gz
Add a test for a port comparison bytecode validation bug.
Change-Id: I2f7bd13e96124c6342a21559ca8e086010e8c51a
Diffstat (limited to 'tests')
-rwxr-xr-xtests/net_test/sock_diag_test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/net_test/sock_diag_test.py b/tests/net_test/sock_diag_test.py
index d4a721ea..b5bc1cb0 100755
--- a/tests/net_test/sock_diag_test.py
+++ b/tests/net_test/sock_diag_test.py
@@ -238,6 +238,18 @@ class SockDiagTest(SockDiagBaseTest):
self.assertTrue(all(d in v4sockets for d in diag_msgs))
self.assertTrue(all(d in v6sockets for d in diag_msgs))
+ def testPortComparisonValidation(self):
+ """Checks for a bug in validating port comparison bytecode.
+
+ Relevant kernel commits:
+ android-3.4:
+ 5e1f542 inet_diag: validate port comparison byte code to prevent unsafe reads
+ """
+ bytecode = sock_diag.InetDiagBcOp((sock_diag.INET_DIAG_BC_D_GE, 4, 8))
+ self.assertRaisesErrno(
+ EINVAL,
+ self.sock_diag.DumpAllInetSockets, IPPROTO_TCP, bytecode.Pack())
+
@unittest.skipUnless(HAVE_SOCK_DESTROY, "SOCK_DESTROY not supported")
def testClosesSockets(self):
self.socketpairs = self._CreateLotsOfSockets()