[rkward-cvs] SF.net SVN: rkward:[3599] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue May 24 06:26:03 UTC 2011


Revision: 3599
          http://rkward.svn.sourceforge.net/rkward/?rev=3599&view=rev
Author:   tfry
Date:     2011-05-24 06:26:03 +0000 (Tue, 24 May 2011)

Log Message:
-----------
Proper quoting and more safety measures in help search.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-05-23 20:49:50 UTC (rev 3598)
+++ trunk/rkward/ChangeLog	2011-05-24 06:26:03 UTC (rev 3599)
@@ -1,4 +1,5 @@
 --- Version 0.5.6 - May-XX-2011
+- Fixed: Would crash when searching for a term with quotes in the help search window
 - Add simple man page for command line options
 - Fixed: Potential crash when creating plots from a tcl/tk based GUI
 - Fix compilation on FreeBSD

Modified: trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp	2011-05-23 20:49:50 UTC (rev 3598)
+++ trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp	2011-05-24 06:26:03 UTC (rev 3599)
@@ -2,7 +2,7 @@
                           rkhelpsearchwindow  -  description
                              -------------------
     begin                : Fri Feb 25 2005
-    copyright            : (C) 2005, 2006, 2007, 2009, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -38,6 +38,7 @@
 #include "../debug.h"
 #include "../rkglobals.h"
 #include "../rkward.h"
+#include "../core/robject.h"
 #include "../misc/rkcommonfunctions.h"
 #include "../misc/rkdummypart.h"
 
@@ -161,7 +162,7 @@
 	RK_TRACE (APP);
 
 	// we use .rk.getHelp() instead of plain help() to receive an error, if no help could be found
-	QString command = ".rk.getHelp(\"" + function_name + '\"';
+	QString command = ".rk.getHelp(" + RObject::rQuote (function_name);
 	if (!package.isEmpty ()) command.append (", package=" + package);
 	command.append (")");
 
@@ -196,7 +197,7 @@
 
 	QString fields = fieldsList->itemData (fieldsList->currentIndex ()).toString ();
 
-	QString s = ".rk.get.search.results (\"" + field->currentText () + "\",agrep=" + agrep + ", ignore.case=" + ignoreCase + package + ", fields=" + fields +")";
+	QString s = ".rk.get.search.results (" + RObject::rQuote (field->currentText ()) + ", agrep=" + agrep + ", ignore.case=" + ignoreCase + package + ", fields=" + fields +")";
 	
 	RKGlobals::rInterface ()->issueCommand (s, RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, HELP_SEARCH, 0);
 	setEnabled (false);
@@ -219,6 +220,10 @@
 void RKHelpSearchWindow::rCommandDone (RCommand *command) {
 	RK_TRACE (APP);
 	if (command->getFlags () == HELP_SEARCH) {
+		if (command->failed ()) {
+			RK_ASSERT (false);
+			return;
+		}
 		RK_ASSERT ((command->getDataLength () % 3) == 0);
 		RK_ASSERT (command->getDataType () == RData::StringVector);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list