changeset 30885:960909469245

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Sun, 03 Apr 2022 11:30:26 -0400
parents b77b321f1ac5 (current diff) 0a1aec50a0c8 (diff)
children 4bab8d3fce79
files libinterp/corefcn/gl2ps-print.cc
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-print.cc	Sun Apr 03 14:28:45 2022 +0200
+++ b/libinterp/corefcn/gl2ps-print.cc	Sun Apr 03 11:30:26 2022 -0400
@@ -529,7 +529,11 @@
                     //        Modify resulting svg to use points instead.
                     //        Remove this "else if" block, and
                     //        make header_found true for SVG if gl2ps is fixed.
-                    std::string srchstr (str);
+
+                    // Specify number of characters because STR may have
+                    // come from std::fread and not end with a NUL
+                    // character.
+                    std::string srchstr (str, nread);
                     std::size_t pos = srchstr.find ("<svg ");
                     if (! header_found && pos != std::string::npos)
                       {
--- a/liboctave/array/Sparse.cc	Sun Apr 03 14:28:45 2022 +0200
+++ b/liboctave/array/Sparse.cc	Sun Apr 03 11:30:26 2022 -0400
@@ -1023,7 +1023,7 @@
     {
       octave_idx_type *new_cidx = m_rep->idx_type_allocate (c+1);
       std::copy_n (m_rep->m_cidx, std::min (c, m_rep->m_ncols) + 1, new_cidx);
-      m_rep->idx_type_deallocate (m_rep->m_cidx, m_rep->m_ncols);
+      m_rep->idx_type_deallocate (m_rep->m_cidx, m_rep->m_ncols + 1);
       m_rep->m_cidx = new_cidx;
 
       if (c > m_rep->m_ncols)