diff options
author | Amin Hassani <ahassani@google.com> | 2018-02-23 18:05:34 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-02-23 18:05:34 +0000 |
commit | d87fbb6ae34048bbf432bf4d41878e1bdd320e28 (patch) | |
tree | 6eae1775b7c95cad0f042f62d1baf067bf2dd8ce | |
parent | 69a378eed013461fc46ee5468f4671361d13f800 (diff) | |
parent | 06c3d5304fe58884698b41bede7305a685207642 (diff) | |
download | platform_external_puffin-d87fbb6ae34048bbf432bf4d41878e1bdd320e28.tar.gz platform_external_puffin-d87fbb6ae34048bbf432bf4d41878e1bdd320e28.tar.bz2 platform_external_puffin-d87fbb6ae34048bbf432bf4d41878e1bdd320e28.zip |
Fix a bug in PuffinStream
am: 06c3d5304f
Change-Id: I8ac39cbdda383468a6f9dfb0ae110c66334e0c71
-rw-r--r-- | src/puffin_stream.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/puffin_stream.cc b/src/puffin_stream.cc index e26e2c9..3fb54a1 100644 --- a/src/puffin_stream.cc +++ b/src/puffin_stream.cc @@ -334,7 +334,7 @@ bool PuffinStream::Write(const void* buffer, size_t length) { auto bytes = static_cast<const uint8_t*>(buffer); size_t bytes_wrote = 0; while (bytes_wrote < length) { - if (deflate_bit_pos_ < (cur_deflate_->offset & ~7u)) { + if (deflate_bit_pos_ < (cur_deflate_->offset & ~7ull)) { // Between two puffs or before the first puff. We know that we are // starting from the byte boundary because we have already processed the // non-deflate bits of the last byte of the last deflate. Here we don't @@ -397,7 +397,7 @@ bool PuffinStream::Write(const void* buffer, size_t length) { if (extra_byte_ == 1) { deflate_buffer_->data()[bytes_to_write - 1] |= puff_buffer_->data()[cur_puff_->length] << (deflate_bit_pos_ & 7); - deflate_bit_pos_ = (deflate_bit_pos_ + 7) & ~7u; + deflate_bit_pos_ = (deflate_bit_pos_ + 7) & ~7ull; } else if ((deflate_bit_pos_ & 7) != 0) { // This happens if current and next deflate finish and end on the same // byte, then we cannot write into output until we have huffed the @@ -436,7 +436,7 @@ bool PuffinStream::SetExtraByte() { return true; } size_t end_bit = cur_deflate_->offset + cur_deflate_->length; - if ((end_bit & 7) && ((end_bit + 7) & ~7u) <= (cur_deflate_ + 1)->offset) { + if ((end_bit & 7) && ((end_bit + 7) & ~7ull) <= (cur_deflate_ + 1)->offset) { extra_byte_ = 1; } else { extra_byte_ = 0; |