Skip to content

fix(allocator/vec): fix unsoundness in Vec::extend_from_slices_copy#11200

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-20-fix_allocator_vec_fix_unsoundness_in_vec_extend_from_slices_copy_
May 21, 2025
Merged

fix(allocator/vec): fix unsoundness in Vec::extend_from_slices_copy#11200
graphite-app[bot] merged 1 commit intomainfrom
05-20-fix_allocator_vec_fix_unsoundness_in_vec_extend_from_slices_copy_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 20, 2025

Fix a soundness bug in Vec::extend_from_slices_copy.

Similar to String::from_strs_array_in, we have to handle the possibility that the total length of the slices provided could exceed usize::MAX. If it did, we could reserve too little capacity, and write out of bounds. Used checked addition to catch this.

This bug is present in bumpalo, and we inherited it.

Copy link
Member Author

overlookmotel commented May 20, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-bug Category - Bug label May 20, 2025
@overlookmotel overlookmotel marked this pull request as ready for review May 20, 2025 23:03
@codspeed-hq
Copy link

codspeed-hq bot commented May 20, 2025

CodSpeed Instrumentation Performance Report

Merging #11200 will not alter performance

Comparing 05-20-fix_allocator_vec_fix_unsoundness_in_vec_extend_from_slices_copy_ (250e56f) with 05-20-refactor_allocator_innervec_use_alloc_trait (6827543)

Summary

✅ 38 untouched benchmarks

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label May 21, 2025
Copy link
Member

Dunqing commented May 21, 2025

Merge activity

…#11200)

Fix a soundness bug in `Vec::extend_from_slices_copy`.

Similar to `String::from_strs_array_in`, we have to handle the possibility that the total length of the slices provided could exceed `usize::MAX`. If it did, we could reserve too little capacity, and write out of bounds. Used checked addition to catch this.

This bug is present in `bumpalo`, and we inherited it.
@graphite-app graphite-app bot force-pushed the 05-20-refactor_allocator_innervec_use_alloc_trait branch from 8937f64 to 6827543 Compare May 21, 2025 00:43
@graphite-app graphite-app bot force-pushed the 05-20-fix_allocator_vec_fix_unsoundness_in_vec_extend_from_slices_copy_ branch from e1ef05f to 250e56f Compare May 21, 2025 00:44
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 21, 2025
Base automatically changed from 05-20-refactor_allocator_innervec_use_alloc_trait to main May 21, 2025 00:50
@graphite-app graphite-app bot merged commit 250e56f into main May 21, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 05-20-fix_allocator_vec_fix_unsoundness_in_vec_extend_from_slices_copy_ branch May 21, 2025 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants