Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression test misses the short-read path, and the bounds-error diagnostic needs clarification.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR hardens DPX user-data parsing to prevent truncated or uninitialized data from being published as metadata.
Changes:
- Accounts for the 2048-byte header offset during bounds validation.
- Rejects failed user-data reads.
- Adds malformed-input regression coverage and expected output.
File summaries
| File | Summary |
|---|---|
testsuite/dpx/run.py |
Adds malformed-userdata coverage. Moderate (2 votes): the fixture does not exercise the short-read failure path. |
testsuite/dpx/ref/out.txt |
Records the expected rejection output. |
src/dpx.imageio/dpxinput.cpp |
Validates bounds and read success. Nit (1 vote): the diagnostic should include the offset or required end position. |
Review details
Suppressed comments (1)
src/dpx.imageio/dpxinput.cpp:563
- This condition now also rejects files where the user-data size is smaller than the file size (for example, 2000 bytes versus 2100), so the diagnostic is contradictory and omits the 2048-byte start offset that caused the failure. Include the offset or required end position in the message so the corruption is diagnosable.
errorfmt("Corrupt userbuf: size claims {} but whole file size is {}",
m_dpx.header.UserSize(), m_filesize);
- Files reviewed: 3/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ReadUserData() returns false on a short read, having filled only part of the buffer. We previously ignored the return and added the whole thing as the "dpx:UserData" attribute, so the unread tail -- uninitialized bytes of a default_init_vector -- became part of the metadata. That is worse than a pixel leak: --info prints it, and oiiotool copies it into converted output without anyone reading a scanline, and that might contain stale heap data that could be sensitive. The size guard only compared UserSize against the whole file size, but the block starts after the generic and industry headers, so a file can pass that check and still run off the end. Count the offset, and treat a failed read as an error instead of publishing the result. Assisted-by: Claude Code / claude-opus-5 Signed-off-by: Larry Gritz <lg@larrygritz.com>
lgritz
force-pushed
the
lg-dpx-userdata
branch
from
September 15, 2026 21:31
8b75ae2 to
cbb337f
Compare
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.
ReadUserData() returns false on a short read, having filled only part of the buffer. We previously ignored the return and added the whole thing as the "dpx:UserData" attribute, so the unread tail -- uninitialized bytes of a default_init_vector -- became part of the metadata. That is worse than a pixel leak: --info prints it, and oiiotool copies it into converted output without anyone reading a scanline, and that might contain stale heap data that could be sensitive.
The size guard only compared UserSize against the whole file size, but the block starts after the generic and industry headers, so a file can pass that check and still run off the end. Count the offset, and treat a failed read as an error instead of publishing the result.
Assisted-by: Claude Code / claude-opus-5