Bug 1454367 - Fix TlsExtensionTestGeneric.AlpnZeroLength r=mt
authorTim Taubert <ttaubert@mozilla.com>
Thu, 17 May 2018 11:24:55 +0200
changeset 14353 aedfebde210dad6b51cbe7a71fd51bbf091c8045
parent 14352 593c1580f22728cbb31a58b4914fd98f4cb0be20
child 14354 43018e031dee1b0c7cac16d3de268de3de6d938d
push id3085
push userttaubert@mozilla.com
push dateThu, 17 May 2018 09:25:22 +0000
reviewersmt
bugs1454367
Bug 1454367 - Fix TlsExtensionTestGeneric.AlpnZeroLength r=mt Reviewers: mt Reviewed By: mt Bug #: 1454367 Differential Revision: https://phabricator.services.mozilla.com/D951
gtests/ssl_gtest/ssl_extension_unittest.cc
--- a/gtests/ssl_gtest/ssl_extension_unittest.cc
+++ b/gtests/ssl_gtest/ssl_extension_unittest.cc
@@ -316,17 +316,25 @@ TEST_P(TlsExtensionTestGeneric, AlpnMiss
   EnableAlpn();
   // This will leave the length of the second entry, but no value.
   ClientHelloErrorTest(std::make_shared<TlsExtensionTruncator>(
       client_, ssl_app_layer_protocol_xtn, 5));
 }
 
 TEST_P(TlsExtensionTestGeneric, AlpnZeroLength) {
   EnableAlpn();
-  const uint8_t val[] = {0x01, 0x61, 0x00};
+  const uint8_t val[] = {0x00, 0x03, 0x01, 0x61, 0x00};
+  DataBuffer extension(val, sizeof(val));
+  ClientHelloErrorTest(std::make_shared<TlsExtensionReplacer>(
+      client_, ssl_app_layer_protocol_xtn, extension));
+}
+
+TEST_P(TlsExtensionTestGeneric, AlpnLengthOverflow) {
+  EnableAlpn();
+  const uint8_t val[] = {0x00, 0x03, 0x01, 0x61, 0x01};
   DataBuffer extension(val, sizeof(val));
   ClientHelloErrorTest(std::make_shared<TlsExtensionReplacer>(
       client_, ssl_app_layer_protocol_xtn, extension));
 }
 
 TEST_P(TlsExtensionTestGeneric, AlpnMismatch) {
   const uint8_t client_alpn[] = {0x01, 0x61};
   client_->EnableAlpn(client_alpn, sizeof(client_alpn));