1From 362be06fc16a5ad0f9e9aa90cc763c5242e8e35c Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Sat, 9 Feb 2019 12:41:45 +0100
4Subject: [PATCH] ssl_manager.cpp: fix build with gcc 7 and -fpermissive
5
6Change prototype of DERToken::parse function from
7parse(ConstDataRange cdr, size_t* outLength);
8to parse(ConstDataRange cdr, uint64_t* outLength);
9
10Otherwise, we got the following error:
11
12src/mongo/util/net/ssl_manager.cpp: In static member function 'static mongo::StatusWith<mongo::{anonymous}::DERToken> mongo::{anonymous}::DERToken::parse(mongo::ConstDataRange, size_t*)':
13src/mongo/util/net/ssl_manager.cpp:575:79: error: invalid conversion from 'size_t* {aka unsigned int*}' to 'long unsigned int*' [-fpermissive]
14  if (mongoUnsignedAddOverflow64(tagAndLengthByteCount, derLength, outLength) ||
15
16Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
17[Upstream status: https://github.com/mongodb/mongo/pull/1296]
18---
19 src/mongo/util/net/ssl_manager.cpp | 6 +++---
20 1 file changed, 3 insertions(+), 3 deletions(-)
21
22diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp
23index b93ebe84a4..3511eb5d99 100644
24--- a/src/mongo/util/net/ssl_manager.cpp
25+++ b/src/mongo/util/net/ssl_manager.cpp
26@@ -782,7 +782,7 @@ public:
27      *
28      * Returns a DERToken which consists of the (tag, length, value) tuple.
29      */
30-    static StatusWith<DERToken> parse(ConstDataRange cdr, size_t* outLength);
31+    static StatusWith<DERToken> parse(ConstDataRange cdr, uint64_t* outLength);
32
33 private:
34     DERType _type{DERType::EndOfContent};
35@@ -799,7 +799,7 @@ struct DataType::Handler<DERToken> {
36                        size_t length,
37                        size_t* advanced,
38                        std::ptrdiff_t debug_offset) {
39-        size_t outLength;
40+        uint64_t outLength;
41
42         auto swPair = DERToken::parse(ConstDataRange(ptr, length), &outLength);
43
44@@ -844,7 +844,7 @@ StatusWith<std::string> readDERString(ConstDataRangeCursor& cdc) {
45 }
46
47
48-StatusWith<DERToken> DERToken::parse(ConstDataRange cdr, size_t* outLength) {
49+StatusWith<DERToken> DERToken::parse(ConstDataRange cdr, uint64_t* outLength) {
50     const size_t kTagLength = 1;
51     const size_t kTagLengthAndInitialLengthByteLength = kTagLength + 1;
52
53--
542.14.1
55
56