Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If a file path references a parent directory, transform it to ensure we keep inside the OUT_DIR #786

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

codyps
Copy link
Contributor

@codyps codyps commented Feb 2, 2023

Otherwise, source file paths like ../../../../foo.c can result in writing $CARGO_TARGET_DIR/foo.o (or worse escapes into the wider filesystem).

This is a slightly more aggressive application of object path re-writing than strictly needed to ensure we don't have OUT_DIR escapes, but it should be perfectly effective.

…we keep inside the OUT_DIR

Otherwise, source file paths like `../../../../foo.c` can result in
writing `$CARGO_TARGET_DIR/foo.o`.

This is a slightly more aggressive application of object path re-writing
than strictly needed to ensure we don't have `OUT_DIR` escapes, but it
should be perfectly effective.
Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

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

Nice catch.

@thomcc thomcc merged commit cadbb52 into rust-lang:main Feb 2, 2023
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.

None yet

2 participants