changeset 28489:aabfd3f51d0b

Fix heap-buffer-overflow in scatter graphics object. * libinterp/corefcn/graphics.cc (scatter::properties::update_color): Check if seriesindex is valid (fix error if scatter::initialize has not run yet).
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 20 Jun 2020 14:09:09 +0200
parents 4304bf2b450b
children d4e8887117b7
files libinterp/corefcn/graphics.cc
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Thu Jun 18 13:26:34 2020 -0400
+++ b/libinterp/corefcn/graphics.cc	Sat Jun 20 14:09:09 2020 +0200
@@ -10273,6 +10273,10 @@
   if (updating_scatter_cdata)
     return;
 
+  Matrix series_idx = get_seriesindex ().matrix_value ();
+  if (series_idx.isempty ())
+    return;
+
   gh_manager& gh_mgr
     = octave::__get_gh_manager__ ("scatter::properties::update_color");
 
@@ -10283,7 +10287,6 @@
         (go.get_ancestor ("axes").get_properties ());
 
   Matrix color_order = parent_axes_prop.get_colororder ().matrix_value ();
-  Matrix series_idx = get_seriesindex ().matrix_value ();
   octave_idx_type s = (static_cast<octave_idx_type> (series_idx(0)) - 1)
                       % color_order.rows ();