Repository navigation
gui: patch ICU - #4484
gui: patch ICU#4484vvbandeira merged 1 commit into
Conversation
Signed-off-by: LucasYuki <lucasyuki@yahoo.com.br>
There was a problem hiding this comment.
Code Review
This pull request adds a patch for the icu module via Bazel's single_version_override to prevent a segfault when runfiles are not reachable. However, the patch introduces a critical Use-After-Free vulnerability because the pointer to the local std::string buffer (dat_path) becomes dangling once the function returns. The reviewer recommends declaring both runfiles and dat_path as static to ensure their lifetimes persist and the pointer remains valid.
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Advisory — results are log-only and do not affect build status. The authoritative QoR gate remains the local rules-file check. Commit 63 design(s) checked — 0 with regression(s), 2 without a comparable baseline.
|
|
The only design that is failing is coralnpu asap7 |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Fix done using Claude.
This PR implements the same fix as https://github.com/The-OpenROAD-Project-private/OpenROAD/pull/3700, but when compiling with ORFS.
QFileDialog's built-in file listing (QFileSystemModel) sorts entries with a locale-aware compare, which constructs aQCollatorand loads ICU locale data. The Bazel Central Registry'sicumodule patchesu_getDataDirectory()to locate that data viarules_cc::cc::runfiles::Runfiles::Rlocation(), butRunfiles::Create()returnsnullptrwhenever no runfiles tree is reachable, and the overlay dereferences it unconditionally. A binary produced bybazel/install.shhas its.runfilesdirectory stripped after unpacking, so the very first locale-aware compare anywhere in the process — e.g.QFileDialog::getOpenFileNamepopulating its file list — segfaults.This is the same defect class fixed in #11203 for
HelpWidget::sortItems(); that PR's own "Scope" section flagged the file-dialog path as still open: "a file dialog'sQFileSystemModel... would still reach the same unchecked pointer."Rather than patch each call site that happens to trigger a collated sort, this adds a
single_version_overrideon theicumodule (pulled in transitively viaqt-bazel) that null-checksRunfiles::Create()'s result before calling->Rlocation()on it, falling through to ICU's existing""default instead of crashing. This closes the bug for every locale-aware sort in the GUI (file dialogs, sortable timing tables, etc.), not justHelpWidget.Every
icuversion currently in the BCR carries the same unchecked dereference (76.1.bcr.4,78.2.bcr.2, ...), so bumping the version is not a workaround; only patchingputil.cppfixes it. The real fix belongs upstream in the BCR'sicumodule — this override should be dropped once that lands.Type of Change
Impact
No behavior change for anyone whose binary still has a reachable runfiles tree (e.g. running via
bazel run/bazel-bindirectly) —Runfiles::Rlocation()still resolves andpathis still set exactly as before. For an installed binary (no runfiles tree), ICU's data directory now silently falls back to""instead of segfaulting; ICU already handles that case gracefully elsewhere indataDirectoryInitFn(). Fixes the crash reported in #11217 (opening the "Open DB" file dialog) and the equivalent one in OpenROAD-flow-scripts#4454 (DRC Viewer's "Load" file chooser).Verification
./etc/Build.sh).Verified directly at the Bazel module level rather than a full
./etc/Build.shrun:bazelisk mod graphresolvesicu@76.1.bcr.3with the override applied.bazelisk fetchon the real@icuexternal repo, then inspected the materialized source on disk — the null-check is present after the BCR's own overlay patches are applied on top of it.bazelisk build @@icu+//icu4c/source/common:platform(the target compiling the patchedputil.cpp) builds cleanly.qt_bazel_prebuilts's ownMODULE.bazel(a non-root module here) causes Bazel to silently ignore it and refetch the unpatched, vulnerable source — confirming the override must live in whichever module is root (openroadhere, andorfsfor the ORFS-side build), not inqt-bazelitself.No regression test added: this is a Bazel dependency-patch fix with no C++ code path in this repo to exercise, and there's no existing harness for asserting installed-binary runfiles-absent behavior (same reasoning as #11203).
Related Issues
Fixes #4454
Related: OpenROAD#11217