-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix OOB memory access in CSV reader when reading without NA values #13011
Fix OOB memory access in CSV reader when reading without NA values #13011
Conversation
@@ -83,8 +83,8 @@ trie create_serialized_trie(const std::vector<std::string>& keys, rmm::cuda_stre | |||
__host__ __device__ inline bool serialized_trie_contains(device_span<serial_trie_node const> trie, | |||
device_span<char const> key) | |||
{ | |||
if (trie.data() == nullptr || trie.empty()) return false; | |||
if (key.empty()) return trie.front().is_leaf; | |||
if (trie.empty()) { return false; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with trie.data() == nullptr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume it's strictly redundant since a device span with data() == nullptr
will always have size 0.
@@ -83,8 +83,8 @@ trie create_serialized_trie(const std::vector<std::string>& keys, rmm::cuda_stre | |||
__host__ __device__ inline bool serialized_trie_contains(device_span<serial_trie_node const> trie, | |||
device_span<char const> key) | |||
{ | |||
if (trie.data() == nullptr || trie.empty()) return false; | |||
if (key.empty()) return trie.front().is_leaf; | |||
if (trie.empty()) { return false; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume it's strictly redundant since a device span with data() == nullptr
will always have size 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
/merge |
Description
CSV reader uses a trie to read field with special values as nulls. The creation of the trie does not work correctly when there are not special values. This can happen when the NA filter is enabled, but the default NA values are removed, and user does not specify custom values. In this case, use of this trie leads to OOB memory access.
This PR fixes the trie creation to create an empty trie when there are not special values to look for.
Included a C++ test that crashes without the fix.
Checklist