Skip to content

Avoid overflows when summing 32-bit integers#318

Merged
jerebertho merged 1 commit intoalgebraic-solving:masterfrom
wegank:hilbert-malloc-fix-1
Mar 23, 2026
Merged

Avoid overflows when summing 32-bit integers#318
jerebertho merged 1 commit intoalgebraic-solving:masterfrom
wegank:hilbert-malloc-fix-1

Conversation

@wegank
Copy link
Contributor

@wegank wegank commented Mar 23, 2026

This change mirrors the following (though the signedness doesn't matter, I guess)...

msolve/src/neogb/f4sat.c

Lines 222 to 234 in 079d814

static inline unsigned long sum(
const len_t * const ind,
const len_t len)
{
len_t i;
unsigned long sum = 0;
for (i = 0; i < len; i++){
sum += ind[i];
}
return sum;
}

Resolves #125.

Copy link
Contributor

@jerebertho jerebertho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks!

@wegank wegank force-pushed the hilbert-malloc-fix-1 branch from 539cce2 to 4fec684 Compare March 23, 2026 14:00
@wegank wegank marked this pull request as ready for review March 23, 2026 14:06
@jerebertho
Copy link
Contributor

Looks good to me, thanks!

@jerebertho jerebertho merged commit 6b8499f into algebraic-solving:master Mar 23, 2026
6 checks passed
@wegank wegank deleted the hilbert-malloc-fix-1 branch March 23, 2026 15:34
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.

Segmentation fault when computing GB

2 participants