Fix dangling pointer in rust_icu_utext::Text shallow clone#352
Conversation
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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
This was authored by Jules, but I think this is reasonable to do to limit the impact of shallow cloning for now. |
Acknowledged. |
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