Skip to content

[v636][TPython] Fix LoadMacro for filenames containing special characters#22179

Open
guitargeek wants to merge 1 commit intoroot-project:v6-36-00-patchesfrom
guitargeek:bp_1
Open

[v636][TPython] Fix LoadMacro for filenames containing special characters#22179
guitargeek wants to merge 1 commit intoroot-project:v6-36-00-patchesfrom
guitargeek:bp_1

Conversation

@guitargeek
Copy link
Copy Markdown
Contributor

The implementation inserted the file name argument directly into a Python string literal delimited by double quotes, so any " in the name terminated the literal early and made the constructed source invalid (or, with a carefully crafted name, a different program than intended). Escape \, ", \n and \r in the name before using it, so that the whole name is used as a literal.

Also add test coverage for filenames containing these special characters.

(cherry picked from commit fac6e65)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Test Results

    16 files      16 suites   2d 8h 39m 9s ⏱️
 2 752 tests  2 752 ✅ 0 💤 0 ❌
42 503 runs  42 503 ✅ 0 💤 0 ❌

Results for commit c8aca99.

The implementation inserted the file name argument directly into a
Python string literal delimited by double quotes, so any `"` in the name
terminated the literal early and made the constructed source invalid
(or, with a carefully crafted name, a different program than intended).
Escape `\`, `"`, `\n` and `\r` in the name before using it, so that the
whole name is used as a literal.

Also add test coverage for filenames containing these special
characters.

(cherry picked from commit fac6e65)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant