Skip to content

Commit

Permalink
fix use after free
Browse files Browse the repository at this point in the history
Signed-off-by: sunby <sunbingyi1992@gmail.com>
  • Loading branch information
sunby committed Nov 11, 2024
1 parent d1a1a29 commit eba6dca
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions internal/core/src/segcore/SegmentChunkReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ SegmentChunkReader::GetChunkDataAccessor<std::string>(
auto chunk_info =
segment_->chunk_view<std::string_view>(field_id, current_chunk_id);

auto chunk_data = chunk_info.first.data();
auto chunk_valid_data = chunk_info.second;

auto current_chunk_size =
segment_->chunk_size(field_id, current_chunk_id);
return [=,
Expand All @@ -136,13 +133,13 @@ SegmentChunkReader::GetChunkDataAccessor<std::string>(
if (current_chunk_pos >= current_chunk_size) {
current_chunk_id++;
current_chunk_pos = 0;
auto chunk_info = segment_->chunk_view<std::string_view>(
chunk_info = segment_->chunk_view<std::string_view>(

Check warning on line 136 in internal/core/src/segcore/SegmentChunkReader.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/segcore/SegmentChunkReader.cpp#L136

Added line #L136 was not covered by tests
field_id, current_chunk_id);
chunk_data = chunk_info.first.data();
chunk_valid_data = chunk_info.second;
current_chunk_size =
segment_->chunk_size(field_id, current_chunk_id);
}
auto chunk_data = chunk_info.first;
auto chunk_valid_data = chunk_info.second;

Check warning on line 142 in internal/core/src/segcore/SegmentChunkReader.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/segcore/SegmentChunkReader.cpp#L141-L142

Added lines #L141 - L142 were not covered by tests
if (current_chunk_pos < chunk_valid_data.size() &&
!chunk_valid_data[current_chunk_pos]) {
current_chunk_pos++;
Expand Down

0 comments on commit eba6dca

Please sign in to comment.