0001-ssl_manager.cpp-fix-build-with-gcc-7-and-fpermissive.patch 2.3 KB

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