[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15544] trunk/blender/source/blender/src/ poselib.c: Bugfix #17318: PoseLib: Crash while searching for pose typing in letter i then backspace

Joshua Leung aligorith at gmail.com
Sat Jul 12 08:44:57 CEST 2008


Revision: 15544
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15544
Author:   aligorith
Date:     2008-07-12 08:44:57 +0200 (Sat, 12 Jul 2008)

Log Message:
-----------
Bugfix #17318: PoseLib: Crash while searching for pose typing in letter i then backspace

When searching failed to find any matches, the pointer to a matching pose was cleared. However, it wasn't reset upon clearing the invalid search-string, so a crash occurred.

Modified Paths:
--------------
    trunk/blender/source/blender/src/poselib.c

Modified: trunk/blender/source/blender/src/poselib.c
===================================================================
--- trunk/blender/source/blender/src/poselib.c	2008-07-12 06:18:06 UTC (rev 15543)
+++ trunk/blender/source/blender/src/poselib.c	2008-07-12 06:44:57 UTC (rev 15544)
@@ -756,6 +756,13 @@
  */
 static void poselib_preview_get_next (tPoseLib_PreviewData *pld, int step)
 {
+	/* check if we no longer have search-string, but don't have any marker */
+	if (pld->marker == NULL) {
+		if ((step) && (pld->searchstr[0] == 0))
+			pld->marker= pld->act->markers.first;
+	}	
+	
+	/* the following operations assume that there is a starting point and direction */
 	if ((pld->marker) && (step)) {
 		/* search-string dictates a special approach */
 		if (pld->searchstr[0]) {
@@ -1262,9 +1269,14 @@
 					/* get search-string */
 					index= pld.search_cursor;
 					
-					memcpy(&tempstr[0], &pld.searchstr[0], index);
-					tempstr[index]= '|';
-					memcpy(&tempstr[index+1], &pld.searchstr[index], 64-index);
+					if (IN_RANGE(index, 0, 64)) {
+						memcpy(&tempstr[0], &pld.searchstr[0], index);
+						tempstr[index]= '|';
+						memcpy(&tempstr[index+1], &pld.searchstr[index], 64-index);
+					}
+					else {
+						strncpy(tempstr, pld.searchstr, 64);
+					}
 					
 					/* get marker name */
 					if (pld.marker)





More information about the Bf-blender-cvs mailing list