-
Notifications
You must be signed in to change notification settings - Fork 889
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
Check index bounds in compact protocol reader. #16493
Check index bounds in compact protocol reader. #16493
Conversation
@@ -399,6 +404,7 @@ struct parquet_field_binary_list | |||
auto const l = cpr->get_u32(); | |||
CUDF_EXPECTS(l <= static_cast<size_t>(cpr->m_end - cpr->m_cur), "binary length mismatch"); | |||
|
|||
CUDF_EXPECTS(i >= 0 and i < val.size()); |
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.
Looks like the vector is resized in the next line so maybe this check should include l
instead of val.size()
Sorry, the resize is on the vector's vector.
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.
From L103-105, the parquet_field_list
base class where these functions are being called from, it does look like we have an assert which checks the requested field's size, and then modifies i
and v
appropriately to pass to the sub-functions so the checks do seem redundant. I am okay either way though, especially if it was flagged by a security scan.
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.
The index i
to check is already unsigned thus we may not need to check if i < 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.
At L103-105, the
parquet_field_list
base class assert checks the requested field's type and adjustv.size()
and i appropriately before passing them to these sub-functions so the added checks do seem redundant to me.
I am okay with the checks if needed to pass security checks. Otherwise, we can maybe suppress them.
@mhaseeb123 I agree it would be good to suppress these checks. I don't know how these checks work but I will inquire. For now, I think we're safer just to enforce the requirement directly. |
/merge |
Description
This adds bounds checking to the compact protocol reader's read function.
Checklist