[Safety] Add safety checks to vector indexing#6927
Conversation
|
Does it make sense to add a CI run where the use of std::vector triggers a compilation failure similar to what we have for unqualified move? |
That would be great, but I'm not sure how we would add something like this. We could add a script that scans files for the use of |
…ollution and a duckdb_node.hpp issue
|
A couple changes made to
|
|
Merged with #6967 - I suspect that will get merged first, so I figured I'd skip a need to merge later |
|
The PR on the wasm side just got merged, that should be the final puzzle piece to get this PR passing CI 🤞 |
|
I think it makes sense to have the changes to duckdb-wasm hash here, since they are connected. Looks good. Also worth writing down somewhere that currently duck-wasm hash is used only for testing changes in duckdb, and no one is relying on generated build artifacts, so there are no visible consequences, only ducdkb developers will see potentially different test results (but that's true with any PR...). This is to say, it make sense they are tied, and also avoid an extra CI round for no reason. |
|
The inlining of the check is going to require some more work (managing the includes so we don't deal with circular dependencies) I also need to deal with regressions from enabling the check on release anyways, so this could be grouped with that |
|
Thanks! LGTM |
This PR is less massive ;)
The only thing that needed to be done was remove explicit use of
std::vector, and luckily we already hadduckdb/common/vector.hppto introducevectorinto the duckdb namespace.Same as the
unique_ptr, this will likely be a two-phase PR. The first phase is moving away fromstd::vectorto our class (which is derived from std::vector), and the next phase will be to introduce the safety check.The safety check will likely incur some performance issues where vectors are being indexed heavily, and will require some profiling to figure out where this happens.
That's the main reason for doing this in two phases