Fix asan/msan bug

PiperOrigin-RevId: 780237506
This commit is contained in:
Guogang Li
2025-07-07 13:30:50 -07:00
committed by Copybara-Service
parent 6a5d39eb59
commit a2bcb2db27
15 changed files with 25 additions and 24 deletions
+2 -2
View File
@@ -31,7 +31,7 @@ std::optional<std::uint8_t> StreamReader::ReadBits(int bits) {
if (!IsAvailable(1)) {
return std::nullopt;
}
bits_buffer_ = (uint8_t)buffer_.data()[position_++];
bits_buffer_ = (uint8_t)buffer_->data()[position_++];
bits_unused_ = 8;
}
if (bits_unused_ < bits) {
@@ -177,7 +177,7 @@ ExceptionOr<ByteArray> StreamReader::Read(std::int64_t size) {
}
ByteArray read_bytes{static_cast<size_t>(size)};
if (read_bytes.CopyAt(/*offset=*/0, buffer_,
if (read_bytes.CopyAt(/*offset=*/0, *buffer_,
/*source_offset=*/position_)) {
position_ += size;
return ExceptionOr<ByteArray>{read_bytes};