Skip to content

fix: null dereference before guard in repairEndHold#10158

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
suhr25:fix/repair-hold-null-path
Apr 16, 2026
Merged

fix: null dereference before guard in repairEndHold#10158
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
suhr25:fix/repair-hold-null-path

Conversation

@suhr25

@suhr25 suhr25 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes a crash in RepairHold::repairEndHold() caused by using end_path before checking if it’s null. The issue is in src/rsz/src/RepairHold.cc, and the fix simply makes the existing guard actually work.


FIX

Before:

sta::Path* end_path = sta_->vertexWorstSlackPath(end_vertex, min_);
sta::Mode* mode = end_path->mode(sta_);  // crash if null
if (end_path) {

After:

sta::Path* end_path = sta_->vertexWorstSlackPath(end_vertex, min_);
if (end_path) {
    sta::Mode* mode = end_path->mode(sta_);  // safe

VERIFICATION

Run repair_hold on a design with missing/partial constraints. Before, this could segfault when no path exists. After the fix, it skips safely and completes without crashing.

@suhr25 suhr25 force-pushed the fix/repair-hold-null-path branch from dace99a to 7b04b1f Compare April 16, 2026 13:01
end_path->mode() was called before the if (end_path) null check,
making the guard unreachable on a null return. Move the mode
extraction inside the guard where it is actually used.

Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>

@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 fixes a potential null pointer dereference in RepairHold::repairEndHold by ensuring the end_path pointer is validated before accessing its mode method. I have no further feedback to provide.

@suhr25 suhr25 force-pushed the fix/repair-hold-null-path branch from 7b04b1f to 2dae83c Compare April 16, 2026 13:05
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

2 similar comments
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@maliberty maliberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess you have no paths at all?

@maliberty maliberty merged commit 6e984d0 into The-OpenROAD-Project:master Apr 16, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants