Skip to content

Commit

Permalink
Bugfix: Buffers larger than 2^32 bytes do now work.
Browse files Browse the repository at this point in the history
(Backported from 57d4f7c)
  • Loading branch information
joto committed Aug 15, 2017
1 parent d34da40 commit 0d9516b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/osmium/memory/item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ namespace osmium {
constexpr const item_size_type align_bytes = 8;

inline constexpr std::size_t padded_length(std::size_t length) noexcept {
return (length + align_bytes - 1) & ~(align_bytes - 1);
return (length + static_cast<std::size_t>(align_bytes) - 1) &
~(static_cast<std::size_t>(align_bytes) - 1);
}

/**
Expand Down

2 comments on commit 0d9516b

@sebastic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is quite different from the commit it's backported from, is that just to avoid changing the type?

See also the comments by Adam D. Barratt in Debian Bug #873330

@joto
Copy link
Member Author

@joto joto commented on 0d9516b Aug 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is a different fix for the same problem trying to minimize the impact on any existing code using libosmium.

Please sign in to comment.