Skip to content

Commit 59abd5d

Browse files
committed
fixes run-length decode oob access
1 parent cd57e3c commit 59abd5d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cub/cub/block/block_run_length_decode.cuh

+4-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ public:
382382
{
383383
decoded_items[i] = val;
384384
item_offsets[i] = thread_decoded_offset - assigned_run_begin;
385-
if (thread_decoded_offset == assigned_run_end - 1)
385+
386+
// A thread only needs to fetch the next run if this was not the last loop iteration
387+
const bool is_final_loop_iteration = (i + 1 >= DECODED_ITEMS_PER_THREAD);
388+
if (!is_final_loop_iteration && (thread_decoded_offset == assigned_run_end - 1))
386389
{
387390
// We make sure that a thread is not re-entering this conditional when being assigned to the last run already by
388391
// extending the last run's length to all the thread's item

0 commit comments

Comments
 (0)