From c655c477fd98e4809e20de185495aad7cba9cf05 Mon Sep 17 00:00:00 2001 From: andyfox-rushc Date: Thu, 6 Jun 2024 00:57:27 -0700 Subject: [PATCH] Added range check for db id in dbNetwork -- move this to database code, once hierarchy brought up. Signed-off-by:Andy Fox Signed-off-by: andyfox-rushc --- src/dbSta/src/dbNetwork.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index ad102659603..8ef79d320d4 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -115,6 +115,10 @@ static constexpr unsigned DBIDTAG_WIDTH = 0x4; ObjectId dbNetwork::getDbNwkObjectId(dbObjectType typ, ObjectId db_id) const { + if (db_id > (std::numeric_limits::max() >> DBIDTAG_WIDTH)) { + logger_->error(ORD, 2019, "Error: database id exceeds capacity"); + } + switch (typ) { case dbITermObj: { return ((db_id << DBIDTAG_WIDTH) | DBITERM_ID);