⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

gui: Add null check and print warning in DbNetDescriptor::highlight()#9388

Closed
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-dbDescriptor-add-null-check
Closed

gui: Add null check and print warning in DbNetDescriptor::highlight()#9388
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-dbDescriptor-add-null-check

Conversation

@openroad-ci
Copy link
Collaborator

Fixes #9383

  • Note that this PR added a defensive to avoid the crash. The root-cause that produces the null net should be found and fixed in another PR.

@github-actions
Copy link
Contributor

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

Copy link
Contributor

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

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 defensive null check in DbNetDescriptor::highlight() to prevent a crash when the net is null, which is a good safety measure. My review includes suggestions to improve how the logger is accessed, promoting better encapsulation and reducing dependencies by using an existing class member instead of a global singleton.

#include "odb/dbWireGraph.h"
#include "odb/geom.h"
#include "options.h"
#include "ord/OpenRoad.hh"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

With the suggested change to use sta_->getLogger(), this include is no longer necessary and can be removed to reduce dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

sta_->getLogger() does not exist.

Comment on lines +1644 to +1646
utl::Logger* logger = ord::OpenRoad::openRoad()->getLogger();
logger->warn(
utl::GUI, 111, "Net is nullptr in DbNetDescriptor::highlight().");
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The logger can be obtained more directly via the sta_ member, which is already available in this class. This avoids using the global OpenRoad singleton and including OpenRoad.hh.

Suggested change
utl::Logger* logger = ord::OpenRoad::openRoad()->getLogger();
logger->warn(
utl::GUI, 111, "Net is nullptr in DbNetDescriptor::highlight().");
sta_->getLogger()->warn(utl::GUI, 111, "Net is nullptr in DbNetDescriptor::highlight().");

odb::dbObject* sink_object = getSink(object);
auto net = getObject(object);
if (net == nullptr) {
utl::Logger* logger = ord::OpenRoad::openRoad()->getLogger();
Copy link
Member

Choose a reason for hiding this comment

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

The singleton should only be used from the .i files not in the c++ core.

@maliberty
Copy link
Member

All the descriptors assume they are given a non-null pointer. I prefer to fix this a level higher.

@maliberty maliberty closed this Jan 29, 2026
@maliberty maliberty deleted the secure-dbDescriptor-add-null-check branch January 29, 2026 21:57
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: Crash in gui::DbNetDescriptor::highlight()

3 participants