fix: avoid null write during skip deserialize#2403
Conversation
Merge Protections🟢 All 3 merge protections satisfied — ready to merge. Show 3 satisfied protections🟢 Require kind label
🟢 Require version label
🟢 Require linked issue for feature/bug PRs
|
There was a problem hiding this comment.
Code Review
This pull request modifies BasicIO::Deserialize to update this->size_ directly using std::max instead of calling this->Write(nullptr, size, offset) when SkipDeserialize is enabled, preventing unnecessary null writes. It also adds a unit test to verify this behavior. The reviewer suggests simplifying the size calculation by removing the redundant offset variable, which is always zero in this branch.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR fixes the skip-deserialize path to avoid invoking writes with null buffers during deserialization, and adds a regression test to ensure WriteImpl is not called in that mode.
Changes:
- Remove the
Write(nullptr, ...)call inBasicIO::DeserializewhenSkipDeserializeis enabled, and updatesize_directly. - Add a regression test IO implementation that fails if
WriteImplis ever called with null data. - Add a new unit test validating cursor/size behavior in skip-deserialize mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/io/reader_io_test.cpp | Adds a regression test and a test IO type to ensure skip-deserialize does not call WriteImpl with null data. |
| src/io/basic_io.h | Updates skip-deserialize deserialization to skip the payload and update size_ without calling Write(nullptr, ...). |
7892a9d to
ec17ab8
Compare
ec17ab8 to
2c40e71
Compare
Signed-off-by: LHT129 <tianlan.lht@antgroup.com> Assisted-by: OpenCode:codex-1/gpt-5.5 Co-authored-by: opencode <opencode@anthropic.com>
2c40e71 to
71d475c
Compare
|
/label S-ready-to-merge |
|
Tick the box to add this pull request to the merge queue (same as
|
Summary
Write(nullptr, size, offset)in theSkipDeserializedeserialize pathWriteImplwith null dataFixes: #2402
Testing
make fmtfmtdownload failure.