Skip to content

Commit

Permalink
Merge pull request #307 from musicinmybrain/issue-304
Browse files Browse the repository at this point in the history
Fix the size formula for an allocation
  • Loading branch information
jgdumas committed Jun 18, 2024
2 parents fd79f1c + 646b775 commit 6c6b45b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions linbox/blackbox/apply.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,10 @@ namespace LinBox
*/
int rclen = (int)num_chunks*2 + 5;

unsigned char* combined = new unsigned char[(size_t)rc*_n*(size_t)rclen];
memset(combined, 0, (size_t)rc*_n*(size_t)rclen);
// https://github.com/linbox-team/linbox/issues/304#issuecomment-1766621021
size_t combined_size = (size_t)rc*_n*(size_t)rclen + 1;
unsigned char* combined = new unsigned char[combined_size];
memset(combined, 0, combined_size);

//order from major index to minor: combining index, component of sol'n, byte
//compute a product (chunk times x) for each chunk
Expand Down

0 comments on commit 6c6b45b

Please sign in to comment.