cccl icon indicating copy to clipboard operation
cccl copied to clipboard

Fix nullptr dereference in vector_base::fill_insert

Open charan-003 opened this issue 3 months ago • 11 comments

[BUG FIX] Fix nullptr dereference in vector_base::fill_insert for empty vectors

Summary

This PR fixes a nullptr dereference that occurs when calling fill_insert on an empty thrust::vector or thrust::device_vector. The issue was that the function would attempt to access begin(), end(), or position on unallocated storage.

Changes

  1. Added a special case for empty vectors that:
    • Handles allocation if needed
    • Uses uninitialized_fill_n directly to avoid iterator operations on unallocated storage

Fixes #2964

charan-003 avatar Sep 26 '25 13:09 charan-003

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

copy-pr-bot[bot] avatar Sep 26 '25 13:09 copy-pr-bot[bot]

Hi @miscco ,

Thank you for your guidance on this issue! I assume that the suggested approach of filling the entire vector with x would change the intended behavior of fill_insert from "inserting at position" to "resizing and filling.

charan-003 avatar Sep 26 '25 13:09 charan-003

/ok to test 08d1ded

bernhardmgruber avatar Oct 07 '25 06:10 bernhardmgruber

🥳 CI Workflow Results

🟩 Finished in 4h 21m: Pass: 100%/159 | Total: 6d 22h | Max: 4h 20m | Hits: 69%/190941

See results here.

github-actions[bot] avatar Oct 07 '25 11:10 github-actions[bot]

@bernhardmgruber @miscco Just wondering if there are any changes needed or anything else I should do for this PR?

charan-003 avatar Oct 08 '25 23:10 charan-003

I will let @miscco review this PR next week.

bernhardmgruber avatar Oct 11 '25 09:10 bernhardmgruber

Hi @miscco Please let me know if any changes are needed for this PR.

charan-003 avatar Oct 31 '25 23:10 charan-003

/ok to test cb9806f

miscco avatar Nov 03 '25 10:11 miscco

😬 CI Workflow Results

🟥 Finished in 2h 32m: Pass: 98%/70 | Total: 2d 15h | Max: 2h 31m | Hits: 68%/115298

See results here.

github-actions[bot] avatar Nov 03 '25 13:11 github-actions[bot]

/ok to test c596538

bernhardmgruber avatar Nov 13 '25 09:11 bernhardmgruber

😬 CI Workflow Results

🟥 Finished in 2h 10m: Pass: 98%/70 | Total: 2d 11h | Max: 2h 09m | Hits: 69%/113023

See results here.

github-actions[bot] avatar Nov 13 '25 11:11 github-actions[bot]

@bernhardmgruber, I hope the failed cases are unrelated to the changes I made

charan-003 avatar Nov 20 '25 04:11 charan-003

@bernhardmgruber, I hope the failed cases are unrelated to the changes I made

Looks like a network issue. I restarted the job.

bernhardmgruber avatar Nov 20 '25 11:11 bernhardmgruber

😬 CI Workflow Results

🟥 Finished in 7d 03h: Pass: 1%/70 | Total: 2d 12h | Max: 2h 09m | Hits: 53%/2423

See results here.

github-actions[bot] avatar Nov 20 '25 13:11 github-actions[bot]

😬 CI Workflow Results

🟥 Finished in 7d 03h: Pass: 1%/70 | Total: 2d 12h | Max: 2h 09m | Hits: 53%/2423

See results here.

github-actions[bot] avatar Nov 20 '25 13:11 github-actions[bot]

😬 CI Workflow Results

🟥 Finished in 7d 03h: Pass: 1%/70 | Total: 2d 12h | Max: 2h 09m | Hits: 53%/2423

See results here.

github-actions[bot] avatar Nov 20 '25 21:11 github-actions[bot]