Skip to content

Commit

Permalink
Fix illegal memory access
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeu committed Oct 19, 2024
1 parent 915d657 commit 4b04756
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2444,7 +2444,9 @@ Mat_VarPrint(const matvar_t *matvar, int printdata)
const char *im = (const char *)complex_data->Im;
for ( i = 0; i < (size_t)sparse->njc - 1; i++ ) {
for ( j = sparse->jc[i];
j < (size_t)sparse->jc[i + 1] && j < (size_t)sparse->ndata; j++ ) {
j < (size_t)sparse->jc[i + 1] && j < (size_t)sparse->ndata &&
j < (size_t)sparse->nir;
j++ ) {
printf(" (%u,%" SIZE_T_FMTSTR ") ", sparse->ir[j] + 1, i + 1);
Mat_PrintNumber(matvar->data_type, re + j * stride);
printf(" + ");
Expand Down

0 comments on commit 4b04756

Please sign in to comment.