comparison libinterp/corefcn/kron.cc @ 19177:faa6a98f8d4b

fix crash in kron introduced in changeset aa9ca67f09fb * kron.cc (kron (const PermMatrix& a, const PermMatrix& b)): Allocate na*nb elements for temporary array.
author John W. Eaton <jwe@octave.org>
date Sun, 21 Sep 2014 16:12:52 -0400
parents 38c54d45d05f
children 1f4455ff2329
comparison
equal deleted inserted replaced
19176:b8bd0b55af45 19177:faa6a98f8d4b
136 { 136 {
137 octave_idx_type na = a.rows (); 137 octave_idx_type na = a.rows ();
138 octave_idx_type nb = b.rows (); 138 octave_idx_type nb = b.rows ();
139 const Array<octave_idx_type>& pa = a.col_perm_vec (); 139 const Array<octave_idx_type>& pa = a.col_perm_vec ();
140 const Array<octave_idx_type>& pb = b.col_perm_vec (); 140 const Array<octave_idx_type>& pb = b.col_perm_vec ();
141 Array<octave_idx_type> res_perm; 141 Array<octave_idx_type> res_perm (na * nb);
142 octave_idx_type rescol = 0; 142 octave_idx_type rescol = 0;
143 for (octave_idx_type i = 0; i < na; i++) 143 for (octave_idx_type i = 0; i < na; i++)
144 { 144 {
145 octave_idx_type a_add = pa(i) * nb; 145 octave_idx_type a_add = pa(i) * nb;
146 for (octave_idx_type j = 0; j < nb; j++) 146 for (octave_idx_type j = 0; j < nb; j++)