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