CodeQL LateNegativeTest.ql defRead.c routerLayer>=0

Code nearby tests 'routeLayer' for negativeness, but it is set and then
used as array index without such a test.
ASSERT added.
This commit is contained in:
Darryl L. Miles 2025-02-13 08:27:03 +00:00 committed by Tim Edwards
parent 8ebad7d1a9
commit d18b40d401
1 changed files with 1 additions and 0 deletions

View File

@ -499,6 +499,7 @@ DefAddRoutes(rootDef, f, oscale, special, netname, ruleset, defLayerMap, annotat
*/
routeLayer = stype;
ASSERT(routerLayer >= 0, "routerLayer<0"); /* positive bounds check */
lefl = defLayerMap[routeLayer].lefInfo;
/* Get correct rule for nondefault rules */