Skip to content

gui: patch ICU - #4484

Merged
vvbandeira merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:bazel-icu-patch
Sep 1, 2026
Merged

vvbandeira merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:bazel-icu-patch

Conversation

@LucasYuki

@LucasYuki LucasYuki commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

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 a QCollator and loads ICU locale data. The Bazel Central Registry's icu module patches u_getDataDirectory() to locate that data via rules_cc::cc::runfiles::Runfiles::Rlocation(), but Runfiles::Create() returns nullptr whenever no runfiles tree is reachable, and the overlay dereferences it unconditionally. A binary produced by bazel/install.sh has its .runfiles directory stripped after unpacking, so the very first locale-aware compare anywhere in the process — e.g. QFileDialog::getOpenFileName populating 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's QFileSystemModel... 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_override on the icu module (pulled in transitively via qt-bazel) that null-checks Runfiles::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 just HelpWidget.

Every icu version 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 patching putil.cpp fixes it. The real fix belongs upstream in the BCR's icu module — this override should be dropped once that lands.

Type of Change

  • Bug fix

Impact

No behavior change for anyone whose binary still has a reachable runfiles tree (e.g. running via bazel run / bazel-bin directly) — Runfiles::Rlocation() still resolves and path is 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 in dataDirectoryInitFn(). 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

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

Verified directly at the Bazel module level rather than a full ./etc/Build.sh run:

  • bazelisk mod graph resolves icu@76.1.bcr.3 with the override applied.
  • bazelisk fetch on the real @icu external 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 patched putil.cpp) builds cleanly.
  • Confirmed by counter-test: moving the same override into qt_bazel_prebuilts's own MODULE.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 (openroad here, and orfs for the ORFS-side build), not in qt-bazel itself.

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

Signed-off-by: LucasYuki <lucasyuki@yahoo.com.br>
@LucasYuki LucasYuki self-assigned this Aug 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@openroad-ci

openroad-ci commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

🔍 QoR check

Metrics 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 80d3a5e · Jenkins build #2 · Baseline: build

63 design(s) checked — 0 with regression(s), 2 without a comparable baseline.
Design Variant Verdict local vs inline passed / failed / missing
asap7/aes base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/aes-block base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/aes-mbff base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/aes_lvt base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/coralnpu — ➖ inconclusive ➖ N/A no metrics produced — flow may have failed before writing metadata.json
asap7/cva6 base ✅ pass ✅ MATCH 12 / 0 / 0
asap7/ethmac base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/ethmac_lvt base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/gcd-ccs base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/jpeg_lvt base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/mock-alu base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/mock-cpu base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/riscv32i-mock-sram base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/swerv_wrapper base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/uart base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/aes base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/aes-hybrid base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/uart-blocks base ✅ pass ✅ MATCH 25 / 0 / 0
gt2n/aes base ✅ pass ✅ MATCH 25 / 0 / 0
gt2n/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
gt2n/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/aes base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/i2c-gpio-expander base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/spi base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/aes base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/ariane133 base ➖ inconclusive ➖ N/A 0 / 0 / 25
nangate45/ariane136 base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/black_parrot base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/bp_be_top base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/bp_fe_top base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/bp_multi_top base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/cva6 base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/dynamic_node base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/mempool_group base ✅ pass ✅ MATCH 12 / 0 / 0
nangate45/swerv base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/swerv_wrapper base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/tinyRocket base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/aes base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/chameleon base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/microwatt base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/aes base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0

@LucasYuki
LucasYuki requested a review from maliberty August 31, 2026 17:31
@LucasYuki

Copy link
Copy Markdown
Contributor Author

The only design that is failing is coralnpu asap7

@eder-matheus

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T17:15:15.675196Z a575972 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: a57597207a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@vvbandeira
vvbandeira merged commit ad6ee6b into The-OpenROAD-Project:master Sep 1, 2026
6 of 8 checks passed
@vvbandeira
vvbandeira deleted the bazel-icu-patch branch September 1, 2026 19:17
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.

GUI seg faults when trying to load DRC report file

4 participants