-
-
Notifications
You must be signed in to change notification settings - Fork 270
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 vuln OSV-2023-77 #5210
Merged
Merged
Fix vuln OSV-2023-77 #5210
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c9110c7
Fix vuln OSV-2023-77
aled-ua 8cebb9c
Committing clang-format changes
github-actions[bot] 2d5377d
use H5_IS_BUFFER_OVERFLOW to check overflow
aled-ua b4ebd70
add size parameter
aled-ua 7e54602
Committing clang-format changes
github-actions[bot] 64568ea
Merge pull request #10 from aled-ua/aled-ua-patch-test
aled-ua 79e7168
Fix the last valid byte in buf
aled-ua File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 logic is generally fine, but a couple of issues here:
H5_IS_BUFFER_OVERFLOW
macro from H5private.h to be consistent with other decode routines throughout the librarybuf
should really be passed in as a parameter to the function rather than relying on it from elsewhere. For example, the size ofbuf
here is actuallycache_ptr->image_len + 1
, which doesn't really make a difference for this case, but it's easy to see how relying oncache_ptr->image_len
here can cause trouble.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.
Thanks for your suggestion, I updated using macros for checking.
But for the second point, all arguments passed in this function so far, buf, seem to be
cache_ptr->image_buffer
, is there any possibility of expansion in the future?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.
Sorry I should have been more clear; what I meant was that we should update
H5C__decode_cache_image_header()
with an extra size parameter for the size ofbuf
and then use that for overflow calculations rather thancache_ptr->image_len
. This is similar to other decode routines where the functions have both a buffer and size of the buffer parameter. The calculations should essentially be the same sincecache_ptr->image_len + 1
is what the callers will be passing in for the size parameter, but it should be a bit safer than relying on the size from thecache_ptr
structure.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.
Oh, sorry, I understand, sounds good, I have added the size parameter.