# HG changeset patch # User John W. Eaton # Date 1648999826 14400 # Node ID 960909469245cdff8ad6bd524bd9b8815c86e944 # Parent b77b321f1ac5d34366894407369a3c700bb38b6c# Parent 0a1aec50a0c82fd9fed4bd64961680f6291d4a75 maint: Merge stable to default. diff -r b77b321f1ac5 -r 960909469245 libinterp/corefcn/gl2ps-print.cc --- 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 ("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)