view OrthancFramework/Resources/Patches/protobuf-3.5.1.patch @ 5838:4b47151dea4c

fix crashes if handling very large images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Oct 2024 18:27:31 +0200
parents 4acad0637cc6
children
line wrap: on
line source

diff -urEb protobuf-3.5.1.orig/src/google/protobuf/stubs/io_win32.cc protobuf-3.5.1/src/google/protobuf/stubs/io_win32.cc
--- protobuf-3.5.1.orig/src/google/protobuf/stubs/io_win32.cc	2023-03-26 20:13:45.095021011 +0200
+++ protobuf-3.5.1/src/google/protobuf/stubs/io_win32.cc	2023-03-26 20:19:19.932920102 +0200
@@ -91,7 +91,12 @@

 template <typename char_type>
 bool null_or_empty(const char_type* s) {
-  return s == nullptr || *s == 0;
+  /**
+   * "nullptr" is not known to Visual Studio 2008, because this is a
+   * C++11 construction, which shouldn't be present in protobuf 3.5.1
+   * that is supposed to comply with C++98.
+   **/
+  return s == NULL || *s == 0;
 }

 // Returns true if the path starts with a drive letter, e.g. "c:".
diff -urEb protobuf-3.5.1.orig/src/google/protobuf/stubs/hash.h protobuf-3.5.1/src/google/protobuf/stubs/hash.h
--- protobuf-3.5.1.orig/src/google/protobuf/stubs/hash.h	2023-03-26 20:13:45.095021011 +0200
+++ protobuf-3.5.1/src/google/protobuf/stubs/hash.h	2023-03-26 20:19:19.932920102 +0200
@@ -1,3 +1,9 @@
+#if _MSC_VER >= 1930       // Since Visual Studio 2022
+#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
+#include <unordered_map>
+#include <hash_map>
+#endif
+
 // Protocol Buffers - Google's data interchange format
 // Copyright 2008 Google Inc.  All rights reserved.
 // https://developers.google.com/protocol-buffers/