changeset 29573:6fc423987872 stable

avoid crash in GUI for rmdir("") (bug #60473) * file-editor.cc (handle_remove_file): Avoid out of bounds indexing for QString object.
author John W. Eaton <jwe@octave.org>
date Thu, 29 Apr 2021 06:32:13 -0400
parents 50aa945836c3
children a94c09582124 3a9000d18596
files libgui/src/m-editor/file-editor.cc
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Fri Apr 23 19:30:43 2021 +0200
+++ b/libgui/src/m-editor/file-editor.cc	Thu Apr 29 06:32:13 2021 -0400
@@ -1119,7 +1119,7 @@
     QString old_name_clean = old_name.trimmed ();
     int s = old_name_clean.size ();
 
-    if (old_name_clean.at (0) == QChar ('\"')
+    if (s > 1 && old_name_clean.at (0) == QChar ('\"')
         && old_name_clean.at (s - 1) == QChar ('\"'))
       old_name_clean = old_name_clean.mid (1, s - 2);