fix(cineon): more robust to invalid numbers of channels & bit depth#5250
Open
lgritz wants to merge 1 commit into
Open
fix(cineon): more robust to invalid numbers of channels & bit depth#5250lgritz wants to merge 1 commit into
lgritz wants to merge 1 commit into
Conversation
Guard against corrupted images, which if they said they had more than the 8 channels allowed by Cineon format, would overrun array bounds while reading the file. And check for valid bit depths. Also opportunistically fix a bug I spotted where a red channel was incrementing the count of greyscale channels rather than the count of red channels -- which must have been a copy and paste error from literally 15 years ago. (But those counters are only used for channel naming, and only if there is more than one greyscale or red channel in the file. So I doubt anybody has ever hit this bug, or ever would have in the future.) Fix possible memory leak by having init() call `m_cin.SetInStream()` with a null handle to clear out the internals. Signed-off-by: Larry Gritz <lg@larrygritz.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Guard against corrupted images, which if they said they had more than the 8 channels allowed by Cineon format, would overrun array bounds while reading the file. And check for valid bit depths.
Also opportunistically fix a bug I spotted where a red channel was incrementing the count of greyscale channels rather than the count of red channels -- which must have been a copy and paste error from literally 15 years ago. (But those counters are only used for channel naming, and only if there is more than one greyscale or red channel in the file. So I doubt anybody has ever hit this bug, or ever would have in the future.)
Fix possible memory leak by having init() call
m_cin.SetInStream()with a null handle to clear out the internals.