CodeQL MissingNegativtyTest.ql magictype>=0 defWrite.c

defnodeVisit()
defblockageVisit()

This variable is used as array index, but the DBTechNameType() API allows
a negative return to occur.
This commit is contained in:
Darryl L. Miles 2025-02-13 08:22:28 +00:00 committed by Tim Edwards
parent 38b25c5d34
commit ad1d9923f9
1 changed files with 2 additions and 0 deletions

View File

@ -764,6 +764,7 @@ defnodeVisit(node, res, cap, defdata)
/* the first pass are picked up from the .ext file. */ /* the first pass are picked up from the .ext file. */
magictype = DBTechNameType(EFLayerNames[lr->r_type]); magictype = DBTechNameType(EFLayerNames[lr->r_type]);
ASSERT(magictype >= 0, "magictype<0");
/* Note that the type of the node might be defined by the type */ /* Note that the type of the node might be defined by the type */
/* in the subcircuit itself, so we need to search for any type */ /* in the subcircuit itself, so we need to search for any type */
@ -2600,6 +2601,7 @@ defblockageVisit(node, res, cap, defobsdata)
return 0; return 0;
magictype = DBTechNameType(EFLayerNames[node->efnode_type]); magictype = DBTechNameType(EFLayerNames[node->efnode_type]);
ASSERT(magictype >= 0, "magictype<0");
TTMaskZero(&tmask); TTMaskZero(&tmask);
TTMaskSetMask(&tmask, &DBConnectTbl[magictype]); TTMaskSetMask(&tmask, &DBConnectTbl[magictype]);