Skip to content

fix: avoid null write during skip deserialize#2403

Merged
LHT129 merged 1 commit into
antgroup:mainfrom
LHT129:opencode/fix-skipdeserialize-nullptr-write
Jul 8, 2026
Merged

fix: avoid null write during skip deserialize#2403
LHT129 merged 1 commit into
antgroup:mainfrom
LHT129:opencode/fix-skipdeserialize-nullptr-write

Conversation

@LHT129

@LHT129 LHT129 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • avoid calling Write(nullptr, size, offset) in the SkipDeserialize deserialize path
  • update the skipped IO size directly after seeking past the serialized payload
  • add regression coverage that verifies skip-deserialize does not invoke WriteImpl with null data

Fixes: #2402

Testing

  • make fmt
  • Not run: build/tests, per maintainer instruction to skip build and tests for this task after the initial test attempt was blocked during dependency configuration by fmt download failure.

Copilot AI review requested due to automatic review settings July 2, 2026 09:54
@LHT129 LHT129 added kind/bug Bug fixes, defects, or unexpected behavior 修复程序错误、缺陷或异常行为 version/1.0 labels Jul 2, 2026
@LHT129 LHT129 self-assigned this Jul 2, 2026
@mergify

mergify Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 3 merge protections satisfied — ready to merge.

Show 3 satisfied protections

🟢 Require kind label

  • label~=^kind/

🟢 Require version label

  • label~=^version/

🟢 Require linked issue for feature/bug PRs

  • body~=(?im)(?:^|[\s\-\*])(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s+(?:#\d+|[\w.\-]+/[\w.\-]+#\d+|https?://github\.com/[\w.\-]+/[\w.\-]+/issues/\d+)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/io/basic_io.h Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in BasicIO::Deserialize when SkipDeserialize is enabled, and update size_ directly.
  • Add a regression test IO implementation that fails if WriteImpl is 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, ...).

Comment thread src/io/basic_io.h Outdated
Comment thread src/io/reader_io/reader_io_test.cpp
Comment thread src/io/reader_io_test.cpp Outdated
@LHT129 LHT129 force-pushed the opencode/fix-skipdeserialize-nullptr-write branch from 7892a9d to ec17ab8 Compare July 2, 2026 11:32
Copilot AI review requested due to automatic review settings July 3, 2026 02:30
@LHT129 LHT129 force-pushed the opencode/fix-skipdeserialize-nullptr-write branch from ec17ab8 to 2c40e71 Compare July 3, 2026 02:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/io/basic_io.h
Signed-off-by: LHT129 <tianlan.lht@antgroup.com>

Assisted-by: OpenCode:codex-1/gpt-5.5

Co-authored-by: opencode <opencode@anthropic.com>
@LHT129 LHT129 force-pushed the opencode/fix-skipdeserialize-nullptr-write branch from 2c40e71 to 71d475c Compare July 6, 2026 07:41
@vsag-bot

vsag-bot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

/label S-ready-to-merge
/waiting-on maintainer
/request-review @jiaweizone
/request-review @inabao

@wxyucs wxyucs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mergify

mergify Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@LHT129 LHT129 merged commit 346bab0 into antgroup:main Jul 8, 2026
20 checks passed
@LHT129 LHT129 deleted the opencode/fix-skipdeserialize-nullptr-write branch July 8, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Bug fixes, defects, or unexpected behavior 修复程序错误、缺陷或异常行为 size/M version/1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix SkipDeserialize null Write call

4 participants