Skip to content

fix(grcc): bounds checking for coupling, nodes, etc - #901

Open
jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:issue-887
Open

fix(grcc): bounds checking for coupling, nodes, etc#901
jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:issue-887

Conversation

@jodavies

@jodavies jodavies commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Cases where we check an array index against, for eg, GRCC_MAXNCPLG should use > and not >=. Cases where we are inserting a new vector entry must remain >= since we about to increment, and then index.

Also increase the default GRCC_MAXNCPLG and GRCC_MAXLEGS to 15.


Not all cases should be > rather than >=. For eg, here

form/sources/grcc.cc

Lines 2135 to 2137 in b7753d5

if (nParticles >= GRCC_MAXMPARTICLES) {
erEnd("particle table overflow (GRCC_MAXMPARTICLES)");
}

we check for nParticles >= GRCC_MAXMPARTICLES because below we increment before using nParticles as an index:

form/sources/grcc.cc

Lines 2168 to 2169 in b7753d5

pid = nParticles++;
particles[pid] = new Particle(this, pid, pinp);

Fixes #887

Cases where we check an array index against, for eg, GRCC_MAXNCPLG
should use > and not >=. Cases where we are inserting a new vector
entry must remain >= since we about to increment, and then index.

Also increase the default GRCC_MAXNCPLG and GRCC_MAXLEGS to 15.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 65.748%. remained the same — jodavies:issue-887 into form-dev:master

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.

Graph Generation with several coupling constants

2 participants