Skip to content
Commits on Source (4)
......@@ -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
......
......@@ -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}")
......
protozero (1.6.6-1) unstable; urgency=medium
* New upstream release.
-- Bas Couwenberg <sebastic@debian.org> Thu, 21 Feb 2019 06:56:30 +0100
protozero (1.6.5-1) unstable; urgency=medium
* New upstream release.
......
......@@ -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);
}
///@{
......
......@@ -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
......@@ -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&);
}
......
......@@ -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&);
}
}
......