[Git][debian-gis-team/protozero][upstream] New upstream version 1.6.6

Bas Couwenberg gitlab at salsa.debian.org
Thu Feb 21 06:11:48 GMT 2019


Bas Couwenberg pushed to branch upstream at Debian GIS Project / protozero


Commits:
e77fe248 by Bas Couwenberg at 2019-02-21T05:55:47Z
New upstream version 1.6.6
- - - - -


6 changed files:

- CHANGELOG.md
- CMakeLists.txt
- include/protozero/pbf_reader.hpp
- include/protozero/version.hpp
- test/unit/test_basic.cpp
- test/unit/test_varint.cpp


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -15,6 +15,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 ### Fixed
 
 
+## [1.6.6] - 2018-02-20
+
+### Fixed
+
+- Fixed several place with possible undefined behaviour.
+
+
 ## [1.6.5] - 2018-02-05
 
 ### Fixed
@@ -339,7 +346,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 - Make pbf reader and writer code endianess-aware.
 
 
-[unreleased]: https://github.com/osmcode/libosmium/compare/v1.6.5...HEAD
+[unreleased]: https://github.com/osmcode/libosmium/compare/v1.6.6...HEAD
+[1.6.5]: https://github.com/osmcode/libosmium/compare/v1.6.5...v1.6.6
 [1.6.5]: https://github.com/osmcode/libosmium/compare/v1.6.4...v1.6.5
 [1.6.4]: https://github.com/osmcode/libosmium/compare/v1.6.3...v1.6.4
 [1.6.3]: https://github.com/osmcode/libosmium/compare/v1.6.2...v1.6.3


=====================================
CMakeLists.txt
=====================================
@@ -14,7 +14,7 @@ project(protozero)
 
 set(PROTOZERO_VERSION_MAJOR 1)
 set(PROTOZERO_VERSION_MINOR 6)
-set(PROTOZERO_VERSION_PATCH 5)
+set(PROTOZERO_VERSION_PATCH 6)
 
 set(PROTOZERO_VERSION
     "${PROTOZERO_VERSION_MAJOR}.${PROTOZERO_VERSION_MINOR}.${PROTOZERO_VERSION_PATCH}")


=====================================
include/protozero/pbf_reader.hpp
=====================================
@@ -99,7 +99,6 @@ class pbf_reader {
     template <typename T>
     T get_varint() {
         const auto val = static_cast<T>(decode_varint(&m_data, m_end));
-        assert(m_data <= m_end);
         return val;
     }
 
@@ -114,7 +113,7 @@ class pbf_reader {
     }
 
     void skip_bytes(pbf_length_type len) {
-        if (m_data + len > m_end) {
+        if (m_end - m_data < len) {
             throw end_of_buffer_exception{};
         }
         m_data += len;
@@ -244,7 +243,7 @@ public:
      * read.
      */
     operator bool() const noexcept { // NOLINT(google-explicit-constructor, hicpp-explicit-conversions)
-        return m_data < m_end;
+        return m_data != m_end;
     }
 
     /**
@@ -478,7 +477,6 @@ public:
             default:
                 break;
         }
-        assert(m_data <= m_end);
     }
 
     ///@{


=====================================
include/protozero/version.hpp
=====================================
@@ -23,12 +23,12 @@ documentation.
 #define PROTOZERO_VERSION_MINOR 6
 
 /// The patch number
-#define PROTOZERO_VERSION_PATCH 5
+#define PROTOZERO_VERSION_PATCH 6
 
 /// 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.6.5"
+#define PROTOZERO_VERSION_STRING "1.6.6"
 
 #endif // PROTOZERO_VERSION_HPP


=====================================
test/unit/test_basic.cpp
=====================================
@@ -49,10 +49,10 @@ TEST_CASE("empty buffer in pbf_reader is okay") {
 }
 
 TEST_CASE("check every possible value for single byte in buffer") {
-    char buffer;
+    char buffer[1];
     for (int i = 0; i <= 255; ++i) {
-        buffer = static_cast<char>(i);
-        protozero::pbf_reader item{&buffer, 1};
+        buffer[0] = static_cast<char>(i);
+        protozero::pbf_reader item{buffer, 1};
 
         REQUIRE(item.length() == 1);
         REQUIRE_FALSE(!item); // test operator bool()
@@ -61,9 +61,9 @@ TEST_CASE("check every possible value for single byte in buffer") {
 }
 
 TEST_CASE("next() should throw when illegal wire type is encountered") {
-    const char buffer = 1u << 3u | 7u;
+    const char buffer[1] = {1u << 3u | 7u};
 
-    protozero::pbf_reader item{&buffer, 1};
+    protozero::pbf_reader item{buffer, 1};
     REQUIRE_THROWS_AS(item.next(), const protozero::unknown_pbf_wire_type_exception&);
 }
 


=====================================
test/unit/test_varint.cpp
=====================================
@@ -191,17 +191,17 @@ TEST_CASE("skip_varint with empty buffer throws") {
 }
 
 TEST_CASE("call skip_varint with every possible value for single byte in buffer") {
-    char buffer;
+    char buffer[1];
     for (int i = 0; i <= 127; ++i) {
-        buffer = static_cast<char>(i);
-        const char* b = &buffer;
-        protozero::skip_varint(&b, &buffer + 1);
-        REQUIRE(b == &buffer + 1);
+        buffer[0] = static_cast<char>(i);
+        const char* b = buffer;
+        protozero::skip_varint(&b, buffer + 1);
+        REQUIRE(b == buffer + 1);
     }
     for (int i = 128; i <= 255; ++i) {
-        buffer = static_cast<char>(i);
-        const char* b = &buffer;
-        REQUIRE_THROWS_AS(protozero::skip_varint(&b, &buffer + 1), const protozero::end_of_buffer_exception&);
+        buffer[0] = static_cast<char>(i);
+        const char* b = buffer;
+        REQUIRE_THROWS_AS(protozero::skip_varint(&b, buffer + 1), const protozero::end_of_buffer_exception&);
     }
 }
 
@@ -211,19 +211,19 @@ TEST_CASE("decode_varint with empty buffer throws") {
 }
 
 TEST_CASE("call decode_varint with every possible value for single byte in buffer") {
-    char buffer;
+    char buffer[1];
     for (int i = 0; i <= 127; ++i) {
         REQUIRE(protozero::length_of_varint(i) == 1);
-        buffer = static_cast<char>(i);
-        const char* b = &buffer;
-        REQUIRE(protozero::decode_varint(&b, &buffer + 1) == i);
-        REQUIRE(b == &buffer + 1);
+        buffer[0] = static_cast<char>(i);
+        const char* b = buffer;
+        REQUIRE(protozero::decode_varint(&b, buffer + 1) == i);
+        REQUIRE(b == buffer + 1);
     }
     for (int i = 128; i <= 255; ++i) {
         REQUIRE(protozero::length_of_varint(i) == 2);
-        buffer = static_cast<char>(i);
-        const char* b = &buffer;
-        REQUIRE_THROWS_AS(protozero::decode_varint(&b, &buffer + 1), const protozero::end_of_buffer_exception&);
+        buffer[0] = static_cast<char>(i);
+        const char* b = buffer;
+        REQUIRE_THROWS_AS(protozero::decode_varint(&b, buffer + 1), const protozero::end_of_buffer_exception&);
     }
 }
 



View it on GitLab: https://salsa.debian.org/debian-gis-team/protozero/commit/e77fe2489d87a596435de7817ae9aa5a9fe7d96b

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/protozero/commit/e77fe2489d87a596435de7817ae9aa5a9fe7d96b
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190221/54a01abc/attachment-0001.html>


More information about the Pkg-grass-devel mailing list