Skip to content

Commit 7c04564

Browse files
committed
Update embedded protozero to version 1.4.4.
1 parent e209d81 commit 7c04564

File tree

6 files changed

+35
-9
lines changed

6 files changed

+35
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1010

1111
### Changed
1212

13+
- Updated embedded protozero to 1.4.4.
14+
1315
### Fixed
1416

17+
- Buffer overflow in osmium::Buffer.
18+
1519

1620
## [2.10.1] - 2016-11-15
1721

include/protozero/byteswap.hpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ documentation.
1818

1919
#include <cstdint>
2020
#include <cassert>
21-
#include <type_traits>
2221

2322
#include <protozero/config.hpp>
2423

@@ -51,9 +50,32 @@ inline uint64_t byteswap_impl(uint64_t value) noexcept {
5150
#endif
5251
}
5352

54-
template <typename T>
55-
inline void byteswap_inplace(T& value) noexcept {
56-
value = static_cast<T>(byteswap_impl(static_cast<typename std::make_unsigned<T>::type>(value)));
53+
inline void byteswap_inplace(uint32_t* ptr) noexcept {
54+
*ptr = byteswap_impl(*ptr);
55+
}
56+
57+
inline void byteswap_inplace(uint64_t* ptr) noexcept {
58+
*ptr = byteswap_impl(*ptr);
59+
}
60+
61+
inline void byteswap_inplace(int32_t* ptr) noexcept {
62+
auto bptr = reinterpret_cast<uint32_t*>(ptr);
63+
*bptr = byteswap_impl(*bptr);
64+
}
65+
66+
inline void byteswap_inplace(int64_t* ptr) noexcept {
67+
auto bptr = reinterpret_cast<uint64_t*>(ptr);
68+
*bptr = byteswap_impl(*bptr);
69+
}
70+
71+
inline void byteswap_inplace(float* ptr) noexcept {
72+
auto bptr = reinterpret_cast<uint32_t*>(ptr);
73+
*bptr = byteswap_impl(*bptr);
74+
}
75+
76+
inline void byteswap_inplace(double* ptr) noexcept {
77+
auto bptr = reinterpret_cast<uint64_t*>(ptr);
78+
*bptr = byteswap_impl(*bptr);
5779
}
5880

5981
} // end namespace detail

include/protozero/iterators.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class const_fixed_iterator {
200200
value_type result;
201201
std::memcpy(&result, m_data, sizeof(value_type));
202202
#if PROTOZERO_BYTE_ORDER != PROTOZERO_LITTLE_ENDIAN
203-
detail::byteswap_inplace(result);
203+
detail::byteswap_inplace(&result);
204204
#endif
205205
return result;
206206
}

include/protozero/pbf_reader.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class pbf_reader {
7777
skip_bytes(sizeof(T));
7878
std::memcpy(&result, m_data - sizeof(T), sizeof(T));
7979
#if PROTOZERO_BYTE_ORDER != PROTOZERO_LITTLE_ENDIAN
80-
detail::byteswap_inplace(result);
80+
detail::byteswap_inplace(&result);
8181
#endif
8282
return result;
8383
}

include/protozero/pbf_writer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class pbf_writer {
9191
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");
9292
protozero_assert(m_data);
9393
#if PROTOZERO_BYTE_ORDER != PROTOZERO_LITTLE_ENDIAN
94-
detail::byteswap_inplace(value);
94+
detail::byteswap_inplace(&value);
9595
#endif
9696
m_data->append(reinterpret_cast<const char*>(&value), sizeof(T));
9797
}

include/protozero/version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ documentation.
2323
#define PROTOZERO_VERSION_MINOR 4
2424

2525
/// The patch number
26-
#define PROTOZERO_VERSION_PATCH 3
26+
#define PROTOZERO_VERSION_PATCH 4
2727

2828
/// The complete version number
2929
#define PROTOZERO_VERSION_CODE (PROTOZERO_VERSION_MAJOR * 10000 + PROTOZERO_VERSION_MINOR * 100 + PROTOZERO_VERSION_PATCH)
3030

3131
/// Version number as string
32-
#define PROTOZERO_VERSION_STRING "1.4.3"
32+
#define PROTOZERO_VERSION_STRING "1.4.4"
3333

3434

3535
#endif // PROTOZERO_VERSION_HPP

0 commit comments

Comments
 (0)