Fix nullptr dereference in vector_base::fill_insert
[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
- Added a special case for empty vectors that:
- Handles allocation if needed
- Uses
uninitialized_fill_ndirectly to avoid iterator operations on unallocated storage
Fixes #2964
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.
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.
/ok to test 08d1ded
🥳 CI Workflow Results
🟩 Finished in 4h 21m: Pass: 100%/159 | Total: 6d 22h | Max: 4h 20m | Hits: 69%/190941
See results here.
@bernhardmgruber @miscco Just wondering if there are any changes needed or anything else I should do for this PR?
I will let @miscco review this PR next week.
Hi @miscco Please let me know if any changes are needed for this PR.
/ok to test cb9806f
😬 CI Workflow Results
🟥 Finished in 2h 32m: Pass: 98%/70 | Total: 2d 15h | Max: 2h 31m | Hits: 68%/115298
See results here.
/ok to test c596538
😬 CI Workflow Results
🟥 Finished in 2h 10m: Pass: 98%/70 | Total: 2d 11h | Max: 2h 09m | Hits: 69%/113023
See results here.
@bernhardmgruber, I hope the failed cases are unrelated to the changes I made
@bernhardmgruber, I hope the failed cases are unrelated to the changes I made
Looks like a network issue. I restarted the job.
😬 CI Workflow Results
🟥 Finished in 7d 03h: Pass: 1%/70 | Total: 2d 12h | Max: 2h 09m | Hits: 53%/2423
See results here.
😬 CI Workflow Results
🟥 Finished in 7d 03h: Pass: 1%/70 | Total: 2d 12h | Max: 2h 09m | Hits: 53%/2423
See results here.
😬 CI Workflow Results
🟥 Finished in 7d 03h: Pass: 1%/70 | Total: 2d 12h | Max: 2h 09m | Hits: 53%/2423
See results here.