Blame SOURCES/ctags-CVE-2014-7204.patch

b1280f
--- ctags/jscript.c.orig	2008-10-13 00:27:38.000000000 +0200
b1280f
+++ ctags/jscript.c	2014-09-30 13:49:34.837349283 +0200
b1280f
@@ -1,5 +1,5 @@
b1280f
 /*
b1280f
- *	 $Id: jscript.c 666 2008-05-15 17:47:31Z dfishburn $
b1280f
+ *	 $Id: jscript.c 791 2012-10-24 01:13:13Z dfishburn $
b1280f
  *
b1280f
  *	 Copyright (c) 2003, Darren Hiebert
b1280f
  *
b1280f
@@ -215,6 +215,7 @@
b1280f
  *	 Tag generation functions
b1280f
  */
b1280f
 
b1280f
+/*
b1280f
 static void makeConstTag (tokenInfo *const token, const jsKind kind)
b1280f
 {
b1280f
 	if (JsKinds [kind].enabled && ! token->ignoreTag )
b1280f
@@ -238,12 +239,13 @@
b1280f
 
b1280f
 	if (JsKinds [kind].enabled && ! token->ignoreTag )
b1280f
 	{
b1280f
-		/*
b1280f
+		*
b1280f
 		 * If a scope has been added to the token, change the token
b1280f
 		 * string to include the scope when making the tag.
b1280f
-		 */
b1280f
+		 *
b1280f
 		if ( vStringLength(token->scope) > 0 )
b1280f
 		{
b1280f
+			*
b1280f
 			fulltag = vStringNew ();
b1280f
 			vStringCopy(fulltag, token->scope);
b1280f
 			vStringCatS (fulltag, ".");
b1280f
@@ -251,8 +253,54 @@
b1280f
 			vStringTerminate(fulltag);
b1280f
 			vStringCopy(token->string, fulltag);
b1280f
 			vStringDelete (fulltag);
b1280f
+			*
b1280f
+ 			jsKind parent_kind = JSTAG_CLASS;
b1280f
+ 
b1280f
+ 			* 
b1280f
+			 * if we're creating a function (and not a method),
b1280f
+ 			 * guess we're inside another function 
b1280f
+			 *
b1280f
+ 			if (kind == JSTAG_FUNCTION)
b1280f
+ 				parent_kind = JSTAG_FUNCTION;
b1280f
+ 
b1280f
+ 			e.extensionFields.scope[0] = JsKinds [parent_kind].name;
b1280f
+ 			e.extensionFields.scope[1] = vStringValue (token->scope);
b1280f
 		}
b1280f
-		makeConstTag (token, kind);
b1280f
+		* makeConstTag (token, kind); *
b1280f
+ 		makeTagEntry (&e);
b1280f
+	}
b1280f
+}
b1280f
+*/
b1280f
+
b1280f
+static void makeJsTag (tokenInfo *const token, const jsKind kind)
b1280f
+{
b1280f
+	if (JsKinds [kind].enabled && ! token->ignoreTag )
b1280f
+	{
b1280f
+		const char *const name = vStringValue (token->string);
b1280f
+		tagEntryInfo e;
b1280f
+		initTagEntry (&e, name);
b1280f
+
b1280f
+		e.lineNumber   = token->lineNumber;
b1280f
+		e.filePosition = token->filePosition;
b1280f
+		e.kindName	   = JsKinds [kind].name;
b1280f
+		e.kind		   = JsKinds [kind].letter;
b1280f
+
b1280f
+		if ( vStringLength(token->scope) > 0 )
b1280f
+		{
b1280f
+			jsKind parent_kind = JSTAG_CLASS;
b1280f
+
b1280f
+			/* 
b1280f
+			 * If we're creating a function (and not a method),
b1280f
+			 * guess we're inside another function 
b1280f
+			 */
b1280f
+			if (kind == JSTAG_FUNCTION)
b1280f
+				parent_kind = JSTAG_FUNCTION;
b1280f
+
b1280f
+			e.extensionFields.scope[0] = JsKinds [parent_kind].name;
b1280f
+			e.extensionFields.scope[1] = vStringValue (token->scope);
b1280f
+		}
b1280f
+
b1280f
+		makeTagEntry (&e);
b1280f
 	}
b1280f
 }
b1280f