changeset 31841:0e046fefbffa

mat2cell: Avoid heap buffer overflow error with only one dimension argument (bug #63682). * libinterp/corefcn/cellfun.cc (do_mat2cell_nd): Use sufficiently large temporary buffer.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 19 Feb 2023 12:45:22 +0100
parents 3291f49ae696
children 79abf4cdcd95
files libinterp/corefcn/cellfun.cc
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/cellfun.cc	Sat Feb 18 15:02:06 2023 +0100
+++ b/libinterp/corefcn/cellfun.cc	Sun Feb 19 12:45:22 2023 +0100
@@ -2076,7 +2076,7 @@
       idxtot += nidx[i];
     }
 
-  OCTAVE_LOCAL_BUFFER_INIT (octave_idx_type, ridx, nd, 0);
+  OCTAVE_LOCAL_BUFFER_INIT (octave_idx_type, ridx, rdv.numel (), 0);
   Array<idx_vector> ra_idx
   (dim_vector (1, std::max (nd, a.ndims ())), idx_vector::colon);