Skip to content

Commit

Permalink
[fix](compress) snappy does not work right
Browse files Browse the repository at this point in the history
Snapy does not work right and be crashes, the patch fixes it.
  • Loading branch information
dataroaring committed Jun 17, 2023
1 parent 5573858 commit 28c7970
Show file tree
Hide file tree
Showing 4 changed files with 82,895 additions and 1 deletion.
4 changes: 4 additions & 0 deletions be/src/olap/rowset/segment_v2/binary_plain_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ class BinaryPlainPageDecoder : public PageDecoder {
_num_elems = decode_fixed32_le((const uint8_t*)&_data[_data.get_size() - sizeof(uint32_t)]);
_offsets_pos = _data.get_size() - (_num_elems + 1) * sizeof(uint32_t);

if (_offsets_pos > _data.get_size() - sizeof(uint32_t)) {
return Status::Corruption("file corruption: offsets pos beyonds data_size: {}, num_element: {}"
", offset_pos: {}", _data.size, _num_elems, _offsets_pos);
}
_parsed = true;

return Status::OK();
Expand Down
2 changes: 1 addition & 1 deletion be/src/util/block_compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class SnappySlicesSource : public snappy::Source {
// we should assure that *len is not 0
*len = _slices[_cur_slice].size - _slice_off;
DCHECK(*len != 0);
return _slices[_cur_slice].data;
return _slices[_cur_slice].data + _slice_off;
}

// Skip the next n bytes. Invalidates any buffer returned by
Expand Down
Loading

0 comments on commit 28c7970

Please sign in to comment.