summaryrefslogtreecommitdiffstats
path: root/security/manager/ssl
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-10-04 22:24:52 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-10-04 22:24:52 +0200
commit95379e33779a5802dc7d5dbb6dd3919cc4607bb9 (patch)
tree29ea871162c5f8d378a839b9fb204ecb095185aa /security/manager/ssl
parentca7ecd37c94e268972697a37eec4e46771c6e6f2 (diff)
downloadUXP-95379e33779a5802dc7d5dbb6dd3919cc4607bb9.tar
UXP-95379e33779a5802dc7d5dbb6dd3919cc4607bb9.tar.gz
UXP-95379e33779a5802dc7d5dbb6dd3919cc4607bb9.tar.lz
UXP-95379e33779a5802dc7d5dbb6dd3919cc4607bb9.tar.xz
UXP-95379e33779a5802dc7d5dbb6dd3919cc4607bb9.zip
Ensure we got an nsISSLStatus when deserializing in TransportSecurityInfo.
Diffstat (limited to 'security/manager/ssl')
-rw-r--r--security/manager/ssl/TransportSecurityInfo.cpp7
-rw-r--r--security/manager/ssl/tests/gtest/DeserializeCertTest.cpp86
2 files changed, 92 insertions, 1 deletions
diff --git a/security/manager/ssl/TransportSecurityInfo.cpp b/security/manager/ssl/TransportSecurityInfo.cpp
index 0e2238ad0..3c7023302 100644
--- a/security/manager/ssl/TransportSecurityInfo.cpp
+++ b/security/manager/ssl/TransportSecurityInfo.cpp
@@ -429,7 +429,12 @@ TransportSecurityInfo::Read(nsIObjectInputStream* stream)
if (NS_FAILED(rv)) {
return rv;
}
- mSSLStatus = BitwiseCast<nsSSLStatus*, nsISupports*>(supports.get());
+ nsCOMPtr<nsISSLStatus> castGuard(do_QueryInterface(supports));
+ if (castGuard) {
+ mSSLStatus = BitwiseCast<nsSSLStatus*, nsISSLStatus*>(castGuard.get());
+ } else {
+ mSSLStatus = nullptr;
+ }
nsCOMPtr<nsISupports> failedCertChainSupports;
rv = NS_ReadOptionalObject(stream, true, getter_AddRefs(failedCertChainSupports));
diff --git a/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp b/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp
index 868ecdba6..c3a4115b3 100644
--- a/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp
+++ b/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp
@@ -94,3 +94,89 @@ TEST(psm_DeserializeCert, gecko46)
ASSERT_EQ(NS_OK, rv);
ASSERT_TRUE(cert);
}
+
+TEST(psm_DeserializeCert, gecko64)
+{
+ // This is a serialization of nsITransportSecurityInfo from gecko 64.
+ // Deserialization should fail.
+ nsCString base64Serialization(
+ "FnhllAKWRHGAlo+ESXykKAAAAAAAAAAAwAAAAAAAAEaphjojH6pBabDSgSnsfLHeAAgAAgAAAAAAAAAAAAAAAAAAAAEAMQFmCjIm"
+ "kVxP+7sgiYWmMt8FvcOXmlQiTNWFiWlrbpbqgwAAAAAAAAX2MIIF8jCCBNqgAwIBAgIQDmTF+8I2reFLFyrrQceMsDANBgkqhkiG"
+ "9w0BAQsFADBwMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMS8w"
+ "LQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNzdXJhbmNlIFNlcnZlciBDQTAeFw0xNTExMDMwMDAwMDBaFw0xODExMjgxMjAw"
+ "MDBaMIGlMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEUMBIGA1UEBxMLTG9zIEFuZ2VsZXMxPDA6BgNVBAoTM0lu"
+ "dGVybmV0IENvcnBvcmF0aW9uIGZvciBBc3NpZ25lZCBOYW1lcyBhbmQgTnVtYmVyczETMBEGA1UECxMKVGVjaG5vbG9neTEYMBYG"
+ "A1UEAxMPd3d3LmV4YW1wbGUub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs0CWL2FjPiXBl61lRfvvE0KzLJmG"
+ "9LWAC3bcBjgsH6NiVVo2dt6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8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQD"
+ "AgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY"
+ "JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlM"
+ "MUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78a"
+ "G6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZd"
+ "kGCevEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9KAA==");
+
+ nsCOMPtr<nsISupports> transportSecurityInfo;
+ nsresult rv = NS_DeserializeObject(base64Serialization, getter_AddRefs(transportSecurityInfo));
+ ASSERT_EQ(NS_ERROR_FACTORY_NOT_REGISTERED, rv);
+ ASSERT_FALSE(transportSecurityInfo);
+}