Skip to content

Dev - #310

Merged
fangfufu merged 1 commit into
masterfrom
dev
Oct 9, 2026
Merged

Dev#310
fangfufu merged 1 commit into
masterfrom
dev

Conversation

@fangfufu

@fangfufu fangfufu commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Link parsing now handles anchors with long text more reliably, preserving the complete text—including text nested within tags—and correctly associating it with the link.
    • Improved handling of very large anchor text prevents buffer-size overflow issues that could interfere with parsing.

In collect_gumbo_text, the initial buffer capacity was hardcoded to 256
bytes without checking if the incoming text chunk plus terminator
exceeded 256 bytes. When anchor text was >= 256 bytes, this caused an
out-of-bounds heap write.

Ensure capacity dynamically doubles until it fits needed bytes
(*len + tlen + 1), check for arithmetic overflow, and add boundary
unit tests covering anchor text lengths 255, 256, 257, and 1024 bytes.

Fixes #308
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1b1bbfa-7673-4fc4-9bd5-933105534986
📥 Commits

Reviewing files that changed from the base of the PR and between 3644ff3 and b933a5d.

📒 Files selected for processing (2)
  • src/link_parser.c
  • tests/test_link.c

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The change adds overflow checks and geometric buffer growth to HTML anchor text collection. Tests cover long anchor labels, boundary text lengths, and text accumulated across nested tags.

Changes

Anchor text collection

Layer / File(s) Summary
Anchor text buffer growth
src/link_parser.c, tests/test_link.c
collect_gumbo_text checks required-size arithmetic for overflow and grows capacity geometrically. Tests verify text preservation at lengths 255, 256, 257, and 1024, text accumulated across nested tags, and parsing of a 256-character anchor label.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b933a

No confirmed issue prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 3 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check Inconclusive The title "Dev" is too vague. It does not identify the buffer-growth and long-anchor handling changes in the pull request. Replace "Dev" with a concise title that describes the primary change, such as "Prevent overflow when collecting long anchor text".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@fangfufu
fangfufu merged commit 5d1dd28 into master Oct 9, 2026
16 checks passed
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