Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out-of-bounds memory read in orc gpuEncodeOrcColumnData #9196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/include/cudf/column/column_device_view.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ __device__ inline bitmask_type get_mask_offset_word(bitmask_type const* __restri
size_type source_word_index = destination_word_index + word_index(source_begin_bit);
bitmask_type curr_word = source[source_word_index];
bitmask_type next_word = 0;
if (word_index(source_end_bit) >
if (word_index(source_end_bit - 1) >
word_index(source_begin_bit +
destination_word_index * detail::size_in_bits<bitmask_type>())) {
next_word = source[source_word_index + 1];
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/io/orc/stripe_enc.cu
Original file line number Diff line number Diff line change
Expand Up @@ -687,12 +687,12 @@ __global__ void __launch_bounds__(block_size)
uint8_t valid = 0;
if (row < s->chunk.leaf_column->size()) {
if (s->chunk.leaf_column->nullable()) {
size_type current_valid_offset = row + s->chunk.leaf_column->offset();
size_type next_valid_offset =
current_valid_offset + min(32, s->chunk.leaf_column->size());

bitmask_type mask = cudf::detail::get_mask_offset_word(
s->chunk.leaf_column->null_mask(), 0, current_valid_offset, next_valid_offset);
auto const current_valid_offset = row + s->chunk.leaf_column->offset();
auto const last_offset =
min(current_valid_offset + 8,
s->chunk.leaf_column->offset() + s->chunk.leaf_column->size());
auto const mask = cudf::detail::get_mask_offset_word(
s->chunk.leaf_column->null_mask(), 0, current_valid_offset, last_offset);
valid = 0xff & mask;
} else {
valid = 0xff;
Expand Down