Skip to content

Commit

Permalink
assert that indices to be cast to size_t are nonnegative
Browse files Browse the repository at this point in the history
  • Loading branch information
svigerske committed Nov 20, 2023
1 parent fee4ab2 commit 08ddf67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/scip/prop_symmetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -3957,6 +3957,7 @@ SCIP_RETCODE addWeakSBCsSubgroup(
{
/* add element from lexorder to hashmap.
* Use insert, as duplicate entries in lexorder is not permitted. */
assert((*lexorder)[k] >= 0);
assert( ! SCIPhashmapExists(varsinlexorder, (void*) (size_t) (*lexorder)[k]) ); /* Use int as pointer */
SCIP_CALL( SCIPhashmapInsertInt(varsinlexorder, (void*) (size_t) (*lexorder)[k], k) );
}
Expand All @@ -3979,6 +3980,7 @@ SCIP_RETCODE addWeakSBCsSubgroup(
graphcomp = chosencomppercolor[j];
graphcompsize = graphcompbegins[graphcomp+1] - graphcompbegins[graphcomp];
varidx = firstvaridxpercolor[j];
assert(varidx >= 0);

/* if the first variable was already contained in another orbit or if there are no variables left anyway, skip the
* component */
Expand Down Expand Up @@ -4077,6 +4079,7 @@ SCIP_RETCODE addWeakSBCsSubgroup(
int varidx;

varidx = orbit[activeorb][0];
assert(varidx >= 0);

if ( *maxnvarsorder == 0 )
{
Expand Down

0 comments on commit 08ddf67

Please sign in to comment.