Skip to content

Fix output length accumulation for custom variable expansion#393

Open
sage-mode-hunter wants to merge 2 commits into
vstakhov:masterfrom
sage-mode-hunter:fix-custom-var-expansion-length
Open

Fix output length accumulation for custom variable expansion#393
sage-mode-hunter wants to merge 2 commits into
vstakhov:masterfrom
sage-mode-hunter:fix-custom-var-expansion-length

Conversation

@sage-mode-hunter

@sage-mode-hunter sage-mode-hunter commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Fixed the output length calculation for custom variable expansion.

Root Cause

The custom variable handler was replacing out_len with the expanded variable length instead of adding it, which could result in incorrect length calculation when the variable was part of a larger string.

Fix

Changed:

*out_len = dstlen;

to:

*out_len += dstlen;

This keeps the length calculation consistent with the built-in variable expansion.

Compatibility

This only affects the custom variable handler path and does not change any other parser behavior.

@sage-mode-hunter

Copy link
Copy Markdown
Author

any update?

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