From fabac6cf3ab36dbb82bff747aa99016d7759ccc3 Mon Sep 17 00:00:00 2001 From: tbeu <tbeu@users.noreply.github.com> Date: Mon, 24 Jun 2019 22:27:51 +0200 Subject: [PATCH] Avoid potential division by zero --- src/mat5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mat5.c b/src/mat5.c index a62a61bf..72170826 100644 --- a/src/mat5.c +++ b/src/mat5.c @@ -1322,7 +1322,7 @@ ReadNextStructField( mat_t *mat, matvar_t *matvar ) (void)Mat_uint32Swap(buf); (void)Mat_uint32Swap(buf+1); } - if ( (buf[0] & 0x0000ffff) == MAT_T_INT32 ) { + if ( (buf[0] & 0x0000ffff) == MAT_T_INT32 && buf[1] > 0 ) { fieldname_size = buf[1]; } else { Mat_Critical("Error getting fieldname size");