[libosmium] 01/05: Imported Upstream version 2.10.2

Bas Couwenberg sebastic at debian.org
Wed Nov 16 14:33:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository libosmium.

commit 547ecffa3b8211fafad9b53bf38398c36b1868f9
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Nov 16 14:49:01 2016 +0100

    Imported Upstream version 2.10.2
---
 CHANGELOG.md                                  | 14 ++++++++++++-
 CMakeLists.txt                                |  2 +-
 include/osmium/builder/osm_object_builder.hpp |  6 ++----
 include/osmium/osm/location.hpp               |  4 ++--
 include/osmium/version.hpp                    |  4 ++--
 include/protozero/byteswap.hpp                | 30 +++++++++++++++++++++++----
 include/protozero/iterators.hpp               |  2 +-
 include/protozero/pbf_reader.hpp              |  2 +-
 include/protozero/pbf_writer.hpp              |  2 +-
 include/protozero/version.hpp                 |  4 ++--
 10 files changed, 51 insertions(+), 19 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e97fb21..ef5c656 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 ### Fixed
 
 
+## [2.10.2] - 2016-11-16
+
+### Changed
+
+- Updated embedded protozero to 1.4.4.
+
+### Fixed
+
+- Buffer overflow in osmium::Buffer.
+
+
 ## [2.10.1] - 2016-11-15
 
 ### Changed
@@ -469,7 +480,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
   Doxygen (up to version 1.8.8). This version contains a workaround to fix
   this.
 
-[unreleased]: https://github.com/osmcode/libosmium/compare/v2.10.1...HEAD
+[unreleased]: https://github.com/osmcode/libosmium/compare/v2.10.2...HEAD
+[2.10.2]: https://github.com/osmcode/libosmium/compare/v2.10.1...v2.10.2
 [2.10.1]: https://github.com/osmcode/libosmium/compare/v2.10.0...v2.10.1
 [2.10.0]: https://github.com/osmcode/libosmium/compare/v2.9.0...v2.10.0
 [2.9.0]: https://github.com/osmcode/libosmium/compare/v2.8.0...v2.9.0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93fd76e..6f10b0c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,7 @@ project(libosmium)
 
 set(LIBOSMIUM_VERSION_MAJOR 2)
 set(LIBOSMIUM_VERSION_MINOR 10)
-set(LIBOSMIUM_VERSION_PATCH 1)
+set(LIBOSMIUM_VERSION_PATCH 2)
 
 set(LIBOSMIUM_VERSION
     "${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
diff --git a/include/osmium/builder/osm_object_builder.hpp b/include/osmium/builder/osm_object_builder.hpp
index b1c7220..0a8fa6f 100644
--- a/include/osmium/builder/osm_object_builder.hpp
+++ b/include/osmium/builder/osm_object_builder.hpp
@@ -413,11 +413,10 @@ namespace osmium {
                 const auto available_space = min_size_for_user - sizeof(string_size_type) - 1;
                 if (length > available_space) {
                     const auto space_needed = osmium::memory::padded_length(length - available_space);
-                    reserve_space(space_needed);
+                    std::fill_n(reserve_space(space_needed), space_needed, 0);
                     add_size(static_cast<uint32_t>(space_needed));
                 }
                 std::copy_n(user, length, object().data() + size_of_object);
-                std::fill_n(object().data() + size_of_object + length, osmium::memory::padded_length(length + 1) - length, 0);
                 object().set_user_size(length + 1);
 
                 return static_cast<TDerived&>(*this);
@@ -612,11 +611,10 @@ namespace osmium {
                 const auto available_space = min_size_for_user - 1;
                 if (length > available_space) {
                     const auto space_needed = osmium::memory::padded_length(length - available_space);
-                    reserve_space(space_needed);
+                    std::fill_n(reserve_space(space_needed), space_needed, 0);
                     add_size(static_cast<uint32_t>(space_needed));
                 }
                 std::copy_n(user, length, object().data() + sizeof(Changeset));
-                std::fill_n(object().data() + sizeof(Changeset) + length, osmium::memory::padded_length(length + 1) - length, 0);
                 object().set_user_size(length + 1);
 
                 return *this;
diff --git a/include/osmium/osm/location.hpp b/include/osmium/osm/location.hpp
index d208717..bc03a2e 100644
--- a/include/osmium/osm/location.hpp
+++ b/include/osmium/osm/location.hpp
@@ -512,9 +512,9 @@ namespace osmium {
 
         template <>
         inline size_t hash<8>(const osmium::Location& location) noexcept {
-            size_t h = location.x();
+            uint64_t h = location.x();
             h <<= 32;
-            return h ^ location.y();
+            return static_cast<size_t>(h ^ location.y());
         }
 
     } // namespace detail
diff --git a/include/osmium/version.hpp b/include/osmium/version.hpp
index afdc24f..bae10dd 100644
--- a/include/osmium/version.hpp
+++ b/include/osmium/version.hpp
@@ -35,8 +35,8 @@ DEALINGS IN THE SOFTWARE.
 
 #define LIBOSMIUM_VERSION_MAJOR 2
 #define LIBOSMIUM_VERSION_MINOR 10
-#define LIBOSMIUM_VERSION_PATCH 1
+#define LIBOSMIUM_VERSION_PATCH 2
 
-#define LIBOSMIUM_VERSION_STRING "2.10.1"
+#define LIBOSMIUM_VERSION_STRING "2.10.2"
 
 #endif // OSMIUM_VERSION_HPP
diff --git a/include/protozero/byteswap.hpp b/include/protozero/byteswap.hpp
index 9de42a2..3afb348 100644
--- a/include/protozero/byteswap.hpp
+++ b/include/protozero/byteswap.hpp
@@ -18,7 +18,6 @@ documentation.
 
 #include <cstdint>
 #include <cassert>
-#include <type_traits>
 
 #include <protozero/config.hpp>
 
@@ -51,9 +50,32 @@ inline uint64_t byteswap_impl(uint64_t value) noexcept {
 #endif
 }
 
-template <typename T>
-inline void byteswap_inplace(T& value) noexcept {
-    value = static_cast<T>(byteswap_impl(static_cast<typename std::make_unsigned<T>::type>(value)));
+inline void byteswap_inplace(uint32_t* ptr) noexcept {
+    *ptr = byteswap_impl(*ptr);
+}
+
+inline void byteswap_inplace(uint64_t* ptr) noexcept {
+    *ptr = byteswap_impl(*ptr);
+}
+
+inline void byteswap_inplace(int32_t* ptr) noexcept {
+    auto bptr = reinterpret_cast<uint32_t*>(ptr);
+    *bptr = byteswap_impl(*bptr);
+}
+
+inline void byteswap_inplace(int64_t* ptr) noexcept {
+    auto bptr = reinterpret_cast<uint64_t*>(ptr);
+    *bptr = byteswap_impl(*bptr);
+}
+
+inline void byteswap_inplace(float* ptr) noexcept {
+    auto bptr = reinterpret_cast<uint32_t*>(ptr);
+    *bptr = byteswap_impl(*bptr);
+}
+
+inline void byteswap_inplace(double* ptr) noexcept {
+    auto bptr = reinterpret_cast<uint64_t*>(ptr);
+    *bptr = byteswap_impl(*bptr);
 }
 
 } // end namespace detail
diff --git a/include/protozero/iterators.hpp b/include/protozero/iterators.hpp
index c3107b5..40259a9 100644
--- a/include/protozero/iterators.hpp
+++ b/include/protozero/iterators.hpp
@@ -200,7 +200,7 @@ public:
         value_type result;
         std::memcpy(&result, m_data, sizeof(value_type));
 #if PROTOZERO_BYTE_ORDER != PROTOZERO_LITTLE_ENDIAN
-        detail::byteswap_inplace(result);
+        detail::byteswap_inplace(&result);
 #endif
         return result;
     }
diff --git a/include/protozero/pbf_reader.hpp b/include/protozero/pbf_reader.hpp
index 6187fc2..69f2d72 100644
--- a/include/protozero/pbf_reader.hpp
+++ b/include/protozero/pbf_reader.hpp
@@ -77,7 +77,7 @@ class pbf_reader {
         skip_bytes(sizeof(T));
         std::memcpy(&result, m_data - sizeof(T), sizeof(T));
 #if PROTOZERO_BYTE_ORDER != PROTOZERO_LITTLE_ENDIAN
-        detail::byteswap_inplace(result);
+        detail::byteswap_inplace(&result);
 #endif
         return result;
     }
diff --git a/include/protozero/pbf_writer.hpp b/include/protozero/pbf_writer.hpp
index 5a9f114..77cc9d0 100644
--- a/include/protozero/pbf_writer.hpp
+++ b/include/protozero/pbf_writer.hpp
@@ -91,7 +91,7 @@ class pbf_writer {
         protozero_assert(m_pos == 0 && "you can't add fields to a parent pbf_writer if there is an existing pbf_writer for a submessage");
         protozero_assert(m_data);
 #if PROTOZERO_BYTE_ORDER != PROTOZERO_LITTLE_ENDIAN
-        detail::byteswap_inplace(value);
+        detail::byteswap_inplace(&value);
 #endif
         m_data->append(reinterpret_cast<const char*>(&value), sizeof(T));
     }
diff --git a/include/protozero/version.hpp b/include/protozero/version.hpp
index fbaaaf1..c3e91a3 100644
--- a/include/protozero/version.hpp
+++ b/include/protozero/version.hpp
@@ -23,13 +23,13 @@ documentation.
 #define PROTOZERO_VERSION_MINOR 4
 
 /// The patch number
-#define PROTOZERO_VERSION_PATCH 3
+#define PROTOZERO_VERSION_PATCH 4
 
 /// The complete version number
 #define PROTOZERO_VERSION_CODE (PROTOZERO_VERSION_MAJOR * 10000 + PROTOZERO_VERSION_MINOR * 100 + PROTOZERO_VERSION_PATCH)
 
 /// Version number as string
-#define PROTOZERO_VERSION_STRING "1.4.3"
+#define PROTOZERO_VERSION_STRING "1.4.4"
 
 
 #endif // PROTOZERO_VERSION_HPP

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/libosmium.git



More information about the Pkg-grass-devel mailing list