Skip to content

Commit

Permalink
Avoid uninitialized memory access
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeu committed May 13, 2024
1 parent a9bfd9f commit 62faa04
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mat5.c
Original file line number Diff line number Diff line change
Expand Up @@ -3245,6 +3245,9 @@ Mat_VarRead5(mat_t *mat, matvar_t *matvar)
size_t nbytes = 0;
err = Mul(&nbytes, nelems, matvar->data_size);
if ( err || nbytes > matvar->nbytes ) {
free(matvar->data);
matvar->data = NULL;
matvar->nbytes = 0;
break;
}
}
Expand Down

0 comments on commit 62faa04

Please sign in to comment.