Skip to content

fix(cineon): more robust to invalid numbers of channels & bit depth#5250

Open
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-cineon
Open

fix(cineon): more robust to invalid numbers of channels & bit depth#5250
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-cineon

Conversation

@lgritz

@lgritz lgritz commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant