Version in base suite: 1.5.23-2 Base version: libmatio_1.5.23-2 Target version: libmatio_1.5.23-2+deb12u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/libm/libmatio/libmatio_1.5.23-2.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/libm/libmatio/libmatio_1.5.23-2+deb12u1.dsc changelog | 11 libmatio11.symbols | 1 patches/CVE-2025-2337.patch | 78 ++++++ patches/CVE-2025-2338.patch | 62 +++++ patches/CVE-2025-50343.patch | 530 +++++++++++++++++++++++++++++++++++++++++++ patches/series | 3 6 files changed, 685 insertions(+) dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpat6qy7y9/libmatio_1.5.23-2.dsc: no acceptable signature found dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpat6qy7y9/libmatio_1.5.23-2+deb12u1.dsc: no acceptable signature found diff -Nru libmatio-1.5.23/debian/changelog libmatio-1.5.23/debian/changelog --- libmatio-1.5.23/debian/changelog 2022-06-01 09:36:29.000000000 +0000 +++ libmatio-1.5.23/debian/changelog 2026-06-23 20:48:37.000000000 +0000 @@ -1,3 +1,14 @@ +libmatio (1.5.23-2+deb12u1) bookworm-security; urgency=medium + + * Non-maintainer upload by the LTS Team. + * Cherry-pick patches from upstream for + - CVE-2025-2337 (Closes: #1100992) + - CVE-2025-2338 (Closes: #1104247) + - CVE-2025-50343 (Closes: #1124797) + * debian/libmatio11.symbols: Add Mat_VarCReateStruct2 symbol + + -- Andreas Henriksson Tue, 23 Jun 2026 22:48:37 +0200 + libmatio (1.5.23-2) unstable; urgency=medium * Set HDF5_USE_FILE_LOCKING=FALSE when running the testsuite. diff -Nru libmatio-1.5.23/debian/libmatio11.symbols libmatio-1.5.23/debian/libmatio11.symbols --- libmatio-1.5.23/debian/libmatio11.symbols 2020-09-21 09:39:00.000000000 +0000 +++ libmatio-1.5.23/debian/libmatio11.symbols 2026-06-23 20:48:37.000000000 +0000 @@ -28,6 +28,7 @@ Mat_VarAddStructField@Base 1.5.4 Mat_VarCalloc@Base 1.5.4 Mat_VarCreate@Base 1.5.4 + Mat_VarCreateStruct2@Base 1.5.19-2+deb11u1~ Mat_VarCreateStruct@Base 1.5.4 Mat_VarDelete@Base 1.5.4 Mat_VarDuplicate@Base 1.5.4 diff -Nru libmatio-1.5.23/debian/patches/CVE-2025-2337.patch libmatio-1.5.23/debian/patches/CVE-2025-2337.patch --- libmatio-1.5.23/debian/patches/CVE-2025-2337.patch 1970-01-01 00:00:00.000000000 +0000 +++ libmatio-1.5.23/debian/patches/CVE-2025-2337.patch 2026-06-23 20:48:37.000000000 +0000 @@ -0,0 +1,78 @@ +From: tbeu +Date: Sun, 27 Apr 2025 19:51:00 +0200 +Subject: Fix array index out of bounds when printing bad UTF-8 character data + +As reported by https://github.com/tbeu/matio/issues/267 + +(cherry picked from commit 67000893b627205c42abc125d7917b6b2d18f84f) + +Closes: #1100992 +--- + src/mat.c | 36 ++++++++++++++++++++++++++++++------ + 1 file changed, 30 insertions(+), 6 deletions(-) + +diff --git a/src/mat.c b/src/mat.c +index da5c779..7dcd872 100644 +--- a/src/mat.c ++++ b/src/mat.c +@@ -2328,6 +2328,7 @@ Mat_VarPrint(matvar_t *matvar, int printdata) + case MAT_T_UTF8: { + const mat_uint8_t *data = (const mat_uint8_t *)matvar->data; + size_t k = 0; ++ int err = 0; + size_t *idxOffset; + if ( matvar->nbytes == 0 ) { + break; +@@ -2337,6 +2338,9 @@ Mat_VarPrint(matvar_t *matvar, int printdata) + break; + } + for ( i = 0; i < matvar->dims[0]; i++ ) { ++ if ( err ) { ++ break; ++ } + for ( j = 0; j < matvar->dims[1]; j++ ) { + mat_uint8_t c; + if ( k >= matvar->nbytes ) { +@@ -2345,16 +2349,36 @@ Mat_VarPrint(matvar_t *matvar, int printdata) + idxOffset[i * matvar->dims[1] + j] = k; + c = data[k]; + if ( c <= 0x7F ) { +- } else if ( (c & 0xE0) == 0xC0 && k + 1 < matvar->nbytes ) { +- k = k + 1; +- } else if ( (c & 0xF0) == 0xE0 && k + 2 < matvar->nbytes ) { +- k = k + 2; +- } else if ( (c & 0xF8) == 0xF0 && k + 3 < matvar->nbytes ) { +- k = k + 3; ++ } else if ( (c & 0xE0) == 0xC0 ) { ++ if ( k + 1 < matvar->nbytes ) { ++ k += 1; ++ } else { ++ err = 1; ++ break; ++ } ++ } else if ( (c & 0xF0) == 0xE0 ) { ++ if ( k + 2 < matvar->nbytes ) { ++ k += 2; ++ } else { ++ err = 1; ++ break; ++ } ++ } else if ( (c & 0xF8) == 0xF0 ) { ++ if ( k + 3 < matvar->nbytes ) { ++ k += 3; ++ } else { ++ err = 1; ++ break; ++ } + } + ++k; + } + } ++ if ( err ) { ++ free(idxOffset); ++ Mat_Message("UTF-8 character data error at index %zu", k); ++ break; ++ } + for ( i = 0; i < matvar->dims[0]; i++ ) { + for ( j = 0; j < matvar->dims[1]; j++ ) { + mat_uint8_t c; diff -Nru libmatio-1.5.23/debian/patches/CVE-2025-2338.patch libmatio-1.5.23/debian/patches/CVE-2025-2338.patch --- libmatio-1.5.23/debian/patches/CVE-2025-2338.patch 1970-01-01 00:00:00.000000000 +0000 +++ libmatio-1.5.23/debian/patches/CVE-2025-2338.patch 2026-06-23 20:48:37.000000000 +0000 @@ -0,0 +1,62 @@ +From: tbeu +Date: Sat, 8 Nov 2025 16:21:44 +0100 +Subject: Fix va_list reuse + +As reported by https://github.com/tbeu/matio/issues/269 + +(cherry picked from commit 7b31881ea1da30b075658502961dfcc95353d9ae) +--- + src/io.c | 34 +++++++++++++++++++++++++++------- + 1 file changed, 27 insertions(+), 7 deletions(-) + +diff --git a/src/io.c b/src/io.c +index 2b603e8..1028869 100644 +--- a/src/io.c ++++ b/src/io.c +@@ -59,19 +59,39 @@ static char *strdup_vprintf(const char *format, va_list ap) MATIO_FORMATATTR_VPR + static char * + strdup_vprintf(const char *format, va_list ap) + { +- va_list ap2; + int size; + char *buffer; ++ size_t need; + +- va_copy(ap2, ap); +- size = mat_vsnprintf(NULL, 0, format, ap2) + 1; +- va_end(ap2); ++ { ++ va_list ap2; ++ va_copy(ap2, ap); ++ size = mat_vsnprintf(NULL, 0, format, ap2); ++ va_end(ap2); ++ } ++ ++ if ( size < 0 ) ++ return NULL; + +- buffer = (char *)malloc(size + 1); +- if ( !buffer ) ++ need = (size_t)size + 1; ++ if ( need > (1ULL << 30) ) + return NULL; + +- mat_vsnprintf(buffer, size, format, ap); ++ buffer = (char *)malloc(need); ++ if ( NULL == buffer ) ++ return NULL; ++ ++ { ++ va_list ap2; ++ int written; ++ va_copy(ap2, ap); ++ written = mat_vsnprintf(buffer, need, format, ap2); ++ va_end(ap2); ++ if ( written < 0 || (size_t)written >= need ) { ++ free(buffer); ++ return NULL; ++ } ++ } + return buffer; + } + diff -Nru libmatio-1.5.23/debian/patches/CVE-2025-50343.patch libmatio-1.5.23/debian/patches/CVE-2025-50343.patch --- libmatio-1.5.23/debian/patches/CVE-2025-50343.patch 1970-01-01 00:00:00.000000000 +0000 +++ libmatio-1.5.23/debian/patches/CVE-2025-50343.patch 2026-06-23 20:48:37.000000000 +0000 @@ -0,0 +1,530 @@ +From: tbeu +Date: Mon, 5 Jan 2026 22:03:34 +0100 +Subject: Deprecate usage of Mat_VarCreateStruct in favor of + Mat_VarCreateStruct2 + +As reported by https://github.com/tbeu/matio/issues/275 + +(cherry picked from commit 41b505410dafaa236b61b52c7910d4c4831404f2) + +Closes: #1124797 +--- + cmake/matio_pubconf.cmake.in | 12 ++++ + documentation/Makefile.am | 1 + + documentation/Mat_VarCreateStruct.3 | 4 ++ + documentation/Mat_VarCreateStruct2.3 | 104 +++++++++++++++++++++++++++++++++++ + documentation/quick.texi | 7 +-- + src/matio.h | 4 +- + src/matio.sym | 1 + + src/matio_pubconf.h.in | 12 ++++ + src/matvar_struct.c | 44 ++++++++++++++- + test/test_mat.c | 42 +++++++------- + visual_studio/matio.def | 1 + + visual_studio/matio_pubconf.h | 12 ++++ + 12 files changed, 214 insertions(+), 30 deletions(-) + create mode 100644 documentation/Mat_VarCreateStruct2.3 + +diff --git a/cmake/matio_pubconf.cmake.in b/cmake/matio_pubconf.cmake.in +index b6618c3..311f541 100644 +--- a/cmake/matio_pubconf.cmake.in ++++ b/cmake/matio_pubconf.cmake.in +@@ -184,4 +184,16 @@ + #define MATIO_FORMATATTR_VPRINTF + #endif + ++/* ++ The following macro handles the deprecated attribute. ++*/ ++ ++#if defined(__GNUC__) || defined(__clang__) ++#define MATIO_DEPRECATED __attribute__((deprecated)) ++#elif defined(_MSC_VER) ++#define MATIO_DEPRECATED __declspec(deprecated) ++#else ++#define MATIO_DEPRECATED ++#endif ++ + #endif /* MATIO_PUBCONF_H */ +diff --git a/documentation/Makefile.am b/documentation/Makefile.am +index 258b0b8..58d9a11 100644 +--- a/documentation/Makefile.am ++++ b/documentation/Makefile.am +@@ -43,6 +43,7 @@ dist_man3_MANS = \ + Mat_VarAddStructField.3 \ + Mat_VarCreate.3 \ + Mat_VarCreateStruct.3 \ ++ Mat_VarCreateStruct2.3 \ + Mat_VarDelete.3 \ + Mat_VarFree.3 \ + Mat_VarGetNumberOfFields.3 \ +diff --git a/documentation/Mat_VarCreateStruct.3 b/documentation/Mat_VarCreateStruct.3 +index 41d90a5..36613c3 100644 +--- a/documentation/Mat_VarCreateStruct.3 ++++ b/documentation/Mat_VarCreateStruct.3 +@@ -53,6 +53,9 @@ The structure variable pointer should be free'd when no longer needed using + .Fn Mat_VarFree . + The names of the fields are copied in the function, and thus should be released + after calling the function if necessary. ++.SH DEPRECATED ++This function is deprecated since version 1.5.30. ++Use \fBMat_VarCreateStruct2\fP instead. + .Sh EXAMPLES + This example program opens a MAT file named by the first argument to the + program, and writes a structure named +@@ -100,5 +103,6 @@ main(int argc, char **argv) + } + .Ed + .Sh SEE ALSO ++.Xr Mat_VarCreateStruct2 3 , + .Xr Mat_VarCreate 3 , + .Xr Mat_VarSetStructFieldByName 3 +diff --git a/documentation/Mat_VarCreateStruct2.3 b/documentation/Mat_VarCreateStruct2.3 +new file mode 100644 +index 0000000..d8e61a0 +--- /dev/null ++++ b/documentation/Mat_VarCreateStruct2.3 +@@ -0,0 +1,104 @@ ++.\" Copyright (c) 2015-2025, The matio contributors ++.\" Copyright (c) 2012-2014, Christopher C. Hulbert ++.\" All rights reserved. ++.\" ++.\" Redistribution and use in source and binary forms, with or without ++.\" modification, are permitted provided that the following conditions are met: ++.\" ++.\" 1. Redistributions of source code must retain the above copyright notice, this ++.\" list of conditions and the following disclaimer. ++.\" ++.\" 2. Redistributions in binary form must reproduce the above copyright notice, ++.\" this list of conditions and the following disclaimer in the documentation ++.\" and/or other materials provided with the distribution. ++.\" ++.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ++.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++.\" ++.Dd January 5, 2026 ++.Dt MAT_VARCREATESTRUCT2 3 ++.Os ++.Sh NAME ++.Nm Mat_VarCreateStruct2 ++.Nd Creates a structure variable. ++.Sh SYNOPSIS ++.Fd #include ++.Ft matvar_t * ++.Fo Mat_VarCreateStruct ++.Fa "const char *name" ++.Fa "int rank" ++.Fa "const size_t *dims" ++.Fa "const char *const *fields" ++.Fc ++.Sh DESCRIPTION ++The ++.Fn Mat_VarCreateStruct2 ++function creates a structure variable named ++.Fa name ++that can be written to a MAT file. ++.Sh RETURN VALUES ++If the structure variable was successfully created, a pointer to the variable ++is returned. ++Otherwise NULL is returned. ++The structure variable pointer should be free'd when no longer needed using ++.Fn Mat_VarFree . ++The names of the fields are copied in the function, and thus should be released ++after calling the function if necessary. ++The names of the fields has to be a NULL-terminated array. ++.Sh EXAMPLES ++This example program opens a MAT file named by the first argument to the ++program, and writes a structure named ++.Em a ++to the file. ++.Bd -literal ++#include "matio.h" ++ ++int ++main(int argc, char **argv) ++{ ++ mat_t *matfp; ++ matvar_t *matvar; ++ matvar_t *field; ++ const char *fields[3] = {"field1", "field2", NULL}; ++ double data1 = 1, data2 = 2; ++ size_t dims[2] = {1, 1}; ++ ++ matfp = Mat_Open(argv[1], MAT_ACC_RDWR); ++ if ( NULL == matfp ) { ++ fprintf(stderr, "Error opening MAT file %s\n", argv[1]); ++ return EXIT_FAILURE; ++ } ++ ++ dims[0] = 1; dims[1] = 1; ++ matvar = Mat_VarCreateStruct2("a", 2, dims, fields); ++ if ( NULL == matvar ) { ++ Mat_Close(matfp); ++ return EXIT_FAILURE; ++ } ++ ++ field = Mat_VarCreate(NULL, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, &data1, ++ MAT_F_DONT_COPY_DATA); ++ Mat_VarSetStructFieldByName(matvar, "field1", 0, field); ++ ++ field = Mat_VarCreate(NULL, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, &data2, ++ MAT_F_DONT_COPY_DATA); ++ Mat_VarSetStructFieldByName(matvar, "field2", 0, field); ++ ++ Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_NONE); ++ Mat_VarFree(matvar); ++ ++ Mat_Close(matfp); ++ return EXIT_SUCCESS; ++} ++.Ed ++.Sh SEE ALSO ++.Xr Mat_VarCreate 3 , ++.Xr Mat_VarSetStructFieldByName 3 +diff --git a/documentation/quick.texi b/documentation/quick.texi +index 6809bcd..c93e2d6 100644 +--- a/documentation/quick.texi ++++ b/documentation/quick.texi +@@ -350,7 +350,7 @@ Structure arrays are multidimensional arrays where each element of the array + contains multiple data items as named fields. The fields of a structure can + be accessed by name or index. A field can be a variable of any type (e.g. + numeric, structure, cell arrays, etc.). The preferred method to create a +-structure array is using the @code{Mat_VarCreateStruct} function. After creating ++structure array is using the @code{Mat_VarCreateStruct2} function. After creating + the structure array, the @code{Mat_VarSetStructFieldByName} and + @code{Mat_VarSetStructFieldByIndex} functions can be used to set the fields of + the structure array to a variable. The example below shows how to create a +@@ -372,8 +372,7 @@ main(int argc,char **argv) + y1[10] = {21,22,23,24,25,26,27,28,29,30}, + y2[10] = {31,32,33,34,35,36,37,38,39,40}; + struct mat_complex_split_t z1 = {x1,y1}, z2 = {x2,y2}; +- const char *fieldnames[3] = {"x","y","z"}; +- unsigned nfields = 3; ++ const char *fieldnames[4] = {"x","y","z",NULL}; + + matfp = Mat_CreateVer("test.mat",NULL,MAT_FT_DEFAULT); + if ( NULL == matfp ) { +@@ -381,7 +380,7 @@ main(int argc,char **argv) + return EXIT_FAILURE; + } + +- matvar = Mat_VarCreateStruct("a", 2,struct_dims,fieldnames,nfields); ++ matvar = Mat_VarCreateStruct2("a", 2,struct_dims,fieldnames); + if ( NULL == matvar ) { + fprintf(stderr,"Error creating variable for 'a'\n"); + Mat_Close(matfp); +diff --git a/src/matio.h b/src/matio.h +index 3e6d7de..640b454 100644 +--- a/src/matio.h ++++ b/src/matio.h +@@ -298,8 +298,10 @@ EXTERN matvar_t *Mat_VarCalloc(void); + EXTERN matvar_t *Mat_VarCreate(const char *name, enum matio_classes class_type, + enum matio_types data_type, int rank, size_t *dims, void *data, + int opt); +-EXTERN matvar_t *Mat_VarCreateStruct(const char *name, int rank, size_t *dims, const char **fields, ++EXTERN /*MATIO_DEPRECATED*/ matvar_t *Mat_VarCreateStruct(const char *name, int rank, size_t *dims, const char **fields, + unsigned nfields); ++EXTERN matvar_t *Mat_VarCreateStruct2(const char *name, int rank, const size_t *dims, ++ const char *const *fields); + EXTERN int Mat_VarDelete(mat_t *mat, const char *name); + EXTERN matvar_t *Mat_VarDuplicate(const matvar_t *in, int opt); + EXTERN void Mat_VarFree(matvar_t *matvar); +diff --git a/src/matio.sym b/src/matio.sym +index 97ec75c..4f579ab 100644 +--- a/src/matio.sym ++++ b/src/matio.sym +@@ -24,6 +24,7 @@ Mat_Rewind + Mat_VarCalloc + Mat_VarCreate + Mat_VarCreateStruct ++Mat_VarCreateStruct2 + Mat_VarDelete + Mat_VarDuplicate + Mat_VarFree +diff --git a/src/matio_pubconf.h.in b/src/matio_pubconf.h.in +index ca2f2f3..81c4280 100644 +--- a/src/matio_pubconf.h.in ++++ b/src/matio_pubconf.h.in +@@ -179,4 +179,16 @@ typedef _mat_uint8_t mat_uint8_t; + #define MATIO_FORMATATTR_VPRINTF + #endif + ++/* ++ The following macro handles the deprecated attribute. ++*/ ++ ++#if defined(__GNUC__) || defined(__clang__) ++#define MATIO_DEPRECATED __attribute__((deprecated)) ++#elif defined(_MSC_VER) ++#define MATIO_DEPRECATED __declspec(deprecated) ++#else ++#define MATIO_DEPRECATED ++#endif ++ + #endif /* MATIO_PUBCONF_H */ +diff --git a/src/matvar_struct.c b/src/matvar_struct.c +index 9c86d66..6d7c3d7 100644 +--- a/src/matvar_struct.c ++++ b/src/matvar_struct.c +@@ -42,8 +42,8 @@ + * @param nfields Number of fields in the structure + * @return Pointer to the new structure MATLAB variable on success, NULL on error + */ +-matvar_t * +-Mat_VarCreateStruct(const char *name, int rank, size_t *dims, const char **fields, unsigned nfields) ++static matvar_t * ++VarCreateStruct(const char *name, int rank, size_t *dims, const char **fields, unsigned nfields) + { + size_t nelems = 1; + int j; +@@ -104,6 +104,45 @@ Mat_VarCreateStruct(const char *name, int rank, size_t *dims, const char **field + return matvar; + } + ++/** @brief Creates a structure MATLAB variable with the given name and fields ++ * ++ * @ingroup MAT ++ * @param name Name of the structure variable to create ++ * @param rank Rank of the variable ++ * @param dims array of dimensions of the variable of size rank ++ * @param fields Array of @c nfields fieldnames ++ * @param nfields Number of fields in the structure ++ * @return Pointer to the new structure MATLAB variable on success, NULL on error ++ */ ++matvar_t * ++Mat_VarCreateStruct(const char *name, int rank, size_t *dims, const char **fields, ++ unsigned nfields) ++{ ++ return VarCreateStruct(name, rank, dims, fields, nfields); ++} ++ ++/** @brief Creates a structure MATLAB variable with the given name and fields ++ * ++ * @ingroup MAT ++ * @param name Name of the structure variable to create ++ * @param rank Rank of the variable ++ * @param dims array of dimensions of the variable of size rank ++ * @param fields NULL-terminated array of fieldnames ++ * @return Pointer to the new structure MATLAB variable on success, NULL on error ++ */ ++matvar_t * ++Mat_VarCreateStruct2(const char *name, int rank, const size_t *dims, const char *const *fields) ++{ ++ unsigned count = 0; ++ if ( NULL == fields ) ++ return VarCreateStruct(name, rank, dims, fields, count); ++ ++ while ( fields[count] ) { ++ count++; ++ } ++ return VarCreateStruct(name, rank, dims, fields, count); ++} ++ + /** @brief Adds a field to a structure + * + * Adds the given field to the structure. fields should be an array of matvar_t +@@ -113,6 +152,7 @@ Mat_VarCreateStruct(const char *name, int rank, size_t *dims, const char **field + * @param matvar Pointer to the Structure MAT variable + * @param fieldname Name of field to be added + * @retval 0 on success ++ * @deprecated Use Mat_VarAddStructField2 instead. + */ + int + Mat_VarAddStructField(matvar_t *matvar, const char *fieldname) +diff --git a/test/test_mat.c b/test/test_mat.c +index 7502d77..9177f6d 100644 +--- a/test/test_mat.c ++++ b/test/test_mat.c +@@ -1470,14 +1470,13 @@ test_write_struct_char(const char *output_name) + const char *str = + "aA1[bB2{cC3]dD4}eE5\\fF6|gG7;hH8:iI9'jJ0\"kK!,lL@<" + "mM#.nN$>oO%/pP^?qQ& rR* sS( tT) uU- vV_ wW= xX+ yY` zZ~ "; +- size_t num_fields = 2; +- const char *fieldnames[2] = {"field1", "field2"}; ++ const char *fieldnames[3] = {"field1", "field2", NULL}; + size_t dims[2]; + matvar_t *matvar, *struct_matvar; + + dims[0] = 2; + dims[1] = 1; +- struct_matvar = Mat_VarCreateStruct("a", 2, dims, fieldnames, num_fields); ++ struct_matvar = Mat_VarCreateStruct2("a", 2, dims, fieldnames); + dims[0] = 4; + dims[1] = 26; + matvar = Mat_VarCreate(fieldnames[1], MAT_C_CHAR, MAT_T_UTF8, 2, dims, (void *)str, 0); +@@ -1918,13 +1917,13 @@ test_write_cell_empty_struct(const char *output_name) + if ( mat ) { + int i; + double data[4] = {51., 53., 52., 54.}; +- const char *fieldnames[3] = {"field1", "field2", "field3"}; ++ const char *fieldnames[4] = {"field1", "field2", "field3", NULL}; + cell_matvar = Mat_VarCreate("var1", MAT_C_CELL, MAT_T_CELL, 2, dims, NULL, 0); + + for ( i = 0; i < 3; ++i ) { + dims[0] = 1; + dims[1] = 1; +- struct_matvar = Mat_VarCreateStruct("s", 2, dims, fieldnames, 3); ++ struct_matvar = Mat_VarCreateStruct2("s", 2, dims, fieldnames); + + dims[0] = 2; + dims[1] = 2; +@@ -2405,22 +2404,21 @@ test_struct_api_create(void) + size_t dims[2] = {5, 10}; + int err = 0; + matvar_t *matvar; +- size_t num_fields = 2; +- const char *fieldnames[2] = {"field1", "field2"}; ++ const char *fieldnames[3] = {"field1", "field2", NULL}; + + dims[0] = 2; + dims[1] = 1; +- matvar = Mat_VarCreateStruct("a", 2, dims, fieldnames, num_fields); ++ matvar = Mat_VarCreateStruct2("a", 2, dims, fieldnames); + Mat_VarPrint(matvar, 1); + Mat_VarFree(matvar); + +- matvar = Mat_VarCreateStruct("b", 2, dims, NULL, 0); ++ matvar = Mat_VarCreateStruct2("b", 2, dims, NULL); + Mat_VarPrint(matvar, 1); + Mat_VarFree(matvar); + + dims[0] = 0; + dims[1] = 0; +- matvar = Mat_VarCreateStruct("c", 2, dims, fieldnames, num_fields); ++ matvar = Mat_VarCreateStruct2("c", 2, dims, fieldnames); + Mat_VarPrint(matvar, 1); + Mat_VarFree(matvar); + +@@ -2434,8 +2432,7 @@ test_struct_api_setfield(void) + int err = 0; + double data1[2] = {0, 1}, data2[3] = {2, 3, 4}, data3[3] = {5, 6, 7}, data4[2] = {8, 9}; + matvar_t *fields[5], *matvar; +- const size_t num_fields = 2; +- const char *fieldnames[2] = {"field1", "field2"}; ++ const char *fieldnames[3] = {"field1", "field2", NULL}; + + dims[0] = 2; + dims[1] = 1; +@@ -2455,7 +2452,7 @@ test_struct_api_setfield(void) + Mat_VarCreate(NULL, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, data4, MAT_F_DONT_COPY_DATA); + dims[0] = 2; + dims[1] = 1; +- matvar = Mat_VarCreateStruct("a", 2, dims, fieldnames, num_fields); ++ matvar = Mat_VarCreateStruct2("a", 2, dims, fieldnames); + Mat_VarSetStructFieldByName(matvar, "field1", 0, fields[0]); + Mat_VarSetStructFieldByName(matvar, "field2", 0, fields[1]); + Mat_VarSetStructFieldByName(matvar, "field1", 1, fields[2]); +@@ -2467,7 +2464,7 @@ test_struct_api_setfield(void) + + dims[0] = 2; + dims[1] = 1; +- matvar = Mat_VarCreateStruct("b", 2, dims, fieldnames, num_fields); ++ matvar = Mat_VarCreateStruct2("b", 2, dims, fieldnames); + Mat_VarSetStructFieldByIndex(matvar, 0, 0, fields[3]); + Mat_VarSetStructFieldByIndex(matvar, 1, 0, fields[2]); + Mat_VarSetStructFieldByIndex(matvar, 0, 1, fields[1]); +@@ -2484,14 +2481,13 @@ test_struct_api_getfieldnames(void) + size_t dims[2]; + int err = 0; + matvar_t *matvar; +- const unsigned num_fields = 4; +- const char *fieldnames[4] = {"field1", "field2", "field3", "field4"}; ++ const char *fieldnames[5] = {"field1", "field2", "field3", "field4", NULL}; + unsigned nfields, i; + char *const *fieldnames2; + + dims[0] = 2; + dims[1] = 1; +- matvar = Mat_VarCreateStruct("a", 2, dims, fieldnames, num_fields); ++ matvar = Mat_VarCreateStruct2("a", 2, dims, fieldnames); + nfields = Mat_VarGetNumberOfFields(matvar); + fieldnames2 = Mat_VarGetStructFieldnames(matvar); + printf("Fieldnames of \"a\":\n"); +@@ -2503,7 +2499,7 @@ test_struct_api_getfieldnames(void) + } + Mat_VarFree(matvar); + +- matvar = Mat_VarCreateStruct("b", 2, dims, NULL, 0); ++ matvar = Mat_VarCreateStruct2("b", 2, dims, NULL); + nfields = Mat_VarGetNumberOfFields(matvar); + fieldnames2 = Mat_VarGetStructFieldnames(matvar); + printf("Fieldnames of \"b\":\n"); +@@ -2537,7 +2533,7 @@ test_struct_api_addfield(void) + + dims[0] = 2; + dims[1] = 1; +- matvar = Mat_VarCreateStruct("a", 2, dims, NULL, 0); ++ matvar = Mat_VarCreateStruct2("a", 2, dims, NULL); + + dims[0] = 2; + dims[1] = 1; +@@ -2578,11 +2574,11 @@ test_struct_api_getlinear(void) + mat_complex_split_t z[12]; + matvar_t *field, *matvar, *matvar2; + const size_t num_fields = 3; +- const char *fieldnames[3] = {"r", "c", "z"}; ++ const char *fieldnames[4] = {"r", "c", "z", NULL}; + + dims[0] = 3; + dims[1] = 4; +- matvar = Mat_VarCreateStruct("a", 2, dims, fieldnames, num_fields); ++ matvar = Mat_VarCreateStruct2("a", 2, dims, fieldnames); + + dims[0] = 1; + dims[1] = 1; +@@ -2635,13 +2631,13 @@ test_struct_api_get(void) + }; + matvar_t *field, *matvar, *matvar2; + const size_t num_fields = 2; +- const char *fieldnames[3] = {"r", "c"}; ++ const char *fieldnames[3] = {"r", "c", NULL}; + + dims[0] = 3; + dims[1] = 4; + dims[2] = 5; + dims[3] = 6; +- matvar = Mat_VarCreateStruct("a", 4, dims, fieldnames, num_fields); ++ matvar = Mat_VarCreateStruct2("a", 4, dims, fieldnames); + + dims[0] = 1; + dims[1] = 1; +diff --git a/visual_studio/matio.def b/visual_studio/matio.def +index a5add3f..7e56cd7 100644 +--- a/visual_studio/matio.def ++++ b/visual_studio/matio.def +@@ -25,6 +25,7 @@ EXPORTS + Mat_VarCalloc + Mat_VarCreate + Mat_VarCreateStruct ++ Mat_VarCreateStruct2 + Mat_VarDelete + Mat_VarDuplicate + Mat_VarFree +diff --git a/visual_studio/matio_pubconf.h b/visual_studio/matio_pubconf.h +index a89cc66..399cf74 100644 +--- a/visual_studio/matio_pubconf.h ++++ b/visual_studio/matio_pubconf.h +@@ -179,4 +179,16 @@ typedef _mat_uint8_t mat_uint8_t; + #define MATIO_FORMATATTR_PRINTF2 + #define MATIO_FORMATATTR_VPRINTF + ++/* ++ The following macro handles the deprecated attribute. ++*/ ++ ++#if defined(__GNUC__) || defined(__clang__) ++#define MATIO_DEPRECATED __attribute__((deprecated)) ++#elif defined(_MSC_VER) ++#define MATIO_DEPRECATED __declspec(deprecated) ++#else ++#define MATIO_DEPRECATED ++#endif ++ + #endif /* MATIO_PUBCONF_H */ diff -Nru libmatio-1.5.23/debian/patches/series libmatio-1.5.23/debian/patches/series --- libmatio-1.5.23/debian/patches/series 2022-04-11 13:05:49.000000000 +0000 +++ libmatio-1.5.23/debian/patches/series 2026-06-23 20:48:37.000000000 +0000 @@ -0,0 +1,3 @@ +CVE-2025-2337.patch +CVE-2025-2338.patch +CVE-2025-50343.patch