Skip to content

fix(decoder): corrupt result when a decoder decodes multiple values#954

Open
dxbjavid wants to merge 1 commit into
bytedance:mainfrom
dxbjavid:optdec-pos-offset
Open

fix(decoder): corrupt result when a decoder decodes multiple values#954
dxbjavid wants to merge 1 commit into
bytedance:mainfrom
dxbjavid:optdec-pos-offset

Conversation

@dxbjavid

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en: when a single decoder reads more than one value from the same buffer, the second and later calls begin parsing at a non-zero offset. the opt decoder keeps the whole input in its Json field but only copies data[pos:] into the padded scan buffer, so every node offset ends up shifted by pos and strings or numbers come back from the wrong place; once pos grows past the padding it also reads a little beyond the copied buffer. the utf8-correcting branch just above already stores data[pos:], so this lines the other branch up with it. i have added a regression test that decodes two values from one decoder.

zh(optional):

@CLAassistant

CLAassistant commented Jun 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov-commenter

codecov-commenter commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.24%. Comparing base (59be92f) to head (635c100).
⚠️ Report is 83 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #954      +/-   ##
==========================================
- Coverage   51.86%   51.24%   -0.63%     
==========================================
  Files         127      170      +43     
  Lines       10893    14145    +3252     
==========================================
+ Hits         5650     7248    +1598     
- Misses       4920     6505    +1585     
- Partials      323      392      +69     
Flag Coverage Δ
arm 42.88% <100.00%> (?)
macos-latest 44.05% <100.00%> (?)
ubuntu-24.04-arm 42.88% <100.00%> (?)
ubuntu-latest 49.70% <100.00%> (?)
x86 49.70% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dxbjavid

Copy link
Copy Markdown
Author

Hi maintainers,

Just a friendly follow-up on this PR. When you have a chance, could you please provide an update on its review status?

Happy to make any additional changes if needed.

Thank you!

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.

3 participants