# HG changeset patch # User John W. Eaton # Date 1649046010 14400 # Node ID 05328c2145ff89bb8e041efad5c32d0bcceb25ba # Parent 0a1aec50a0c82fd9fed4bd64961680f6291d4a75 * graphics.cc (convert_position): Avoid possible buffer overflow. diff -r 0a1aec50a0c8 -r 05328c2145ff libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Sun Apr 03 11:29:17 2022 -0400 +++ b/libinterp/corefcn/graphics.cc Mon Apr 04 00:20:10 2022 -0400 @@ -694,7 +694,7 @@ convert_position (const Matrix& pos, const caseless_str& from_units, const caseless_str& to_units, const Matrix& parent_dim) { - Matrix retval (1, pos.numel ()); + Matrix retval (1, pos.numel (), 0.0); double res = 0; bool is_rectangle = (pos.numel () == 4); bool is_2D = (pos.numel () == 2); @@ -829,8 +829,6 @@ } } } - else if (! is_rectangle && ! is_2D) - retval(2) = 0; return retval; }