Skip to content

Fix dangling pointer in rust_icu_utext::Text shallow clone#352

Merged
filmil merged 1 commit intomainfrom
fix-dangling-pointer-utext-clone-2307065140878350585
Apr 28, 2026
Merged

Fix dangling pointer in rust_icu_utext::Text shallow clone#352
filmil merged 1 commit intomainfrom
fix-dangling-pointer-utext-clone-2307065140878350585

Conversation

@filmil
Copy link
Copy Markdown
Member

@filmil filmil commented Apr 28, 2026

Fixes #348

Taking a shallow clone of a Text can result in a dangling pointer if the source is disposed of prior to the shallow clone. This PR addresses the issue by removing the shallow clone capability and always returning a deep clone.


PR created automatically by Jules for task 2307065140878350585 started by @filmil

Taking a shallow clone of a `Text` can result in a dangling pointer if the source
is dropped prior to the clone. This happens because the shallow clone shares the
underlying text buffer but does not tie the lifetimes in Rust.

This fix removes the `deep` and `readonly` parameters from `Text::try_clone` and
always performs a deep clone, ensuring memory safety.

Co-authored-by: filmil <246576+filmil@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@filmil
Copy link
Copy Markdown
Member Author

filmil commented Apr 28, 2026

This was authored by Jules, but I think this is reasonable to do to limit the impact of shallow cloning for now.

@filmil filmil merged commit f107666 into main Apr 28, 2026
14 checks passed
@google-labs-jules
Copy link
Copy Markdown
Contributor

This was authored by Jules, but I think this is reasonable to do to limit the impact of shallow cloning for now.

Acknowledged.

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.

Shallow clone of Text can leave dangling pointer

2 participants