2017-03-07 12:05:05 +01:00
|
|
|
From 7f6e3f1177f0ed53cf2a66ac207f6834591c568c Mon Sep 17 00:00:00 2001
|
|
|
|
From: dfishburn <dfishburn@sf.net>
|
|
|
|
Date: Wed, 24 Oct 2012 01:13:00 +0000
|
|
|
|
Subject: [PATCH 16/19] CVE-2014-7204
|
2014-10-07 09:46:42 +02:00
|
|
|
|
|
|
|
git-svn-id: svn://svn.code.sf.net/p/ctags/code/trunk@791 c5d04d22-be80-434c-894e-aa346cc9e8e8
|
|
|
|
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
|
|
|
|
---
|
2017-03-07 12:05:05 +01:00
|
|
|
jscript.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++---
|
2014-10-07 09:46:42 +02:00
|
|
|
1 file changed, 51 insertions(+), 3 deletions(-)
|
|
|
|
|
2017-03-07 12:05:05 +01:00
|
|
|
diff --git a/jscript.c b/jscript.c
|
|
|
|
index c4e5b1a..901641a 100644
|
|
|
|
--- a/jscript.c
|
|
|
|
+++ b/jscript.c
|
|
|
|
@@ -215,6 +215,7 @@ static void deleteToken (tokenInfo *const token)
|
2014-10-07 09:46:42 +02:00
|
|
|
* Tag generation functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
+/*
|
|
|
|
static void makeConstTag (tokenInfo *const token, const jsKind kind)
|
|
|
|
{
|
|
|
|
if (JsKinds [kind].enabled && ! token->ignoreTag )
|
2017-03-07 12:05:05 +01:00
|
|
|
@@ -238,12 +239,13 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind)
|
2014-10-07 09:46:42 +02:00
|
|
|
|
|
|
|
if (JsKinds [kind].enabled && ! token->ignoreTag )
|
|
|
|
{
|
|
|
|
- /*
|
|
|
|
+ *
|
|
|
|
* If a scope has been added to the token, change the token
|
|
|
|
* string to include the scope when making the tag.
|
|
|
|
- */
|
|
|
|
+ *
|
|
|
|
if ( vStringLength(token->scope) > 0 )
|
|
|
|
{
|
|
|
|
+ *
|
|
|
|
fulltag = vStringNew ();
|
|
|
|
vStringCopy(fulltag, token->scope);
|
|
|
|
vStringCatS (fulltag, ".");
|
2017-03-07 12:05:05 +01:00
|
|
|
@@ -251,8 +253,54 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind)
|
2014-10-07 09:46:42 +02:00
|
|
|
vStringTerminate(fulltag);
|
|
|
|
vStringCopy(token->string, fulltag);
|
|
|
|
vStringDelete (fulltag);
|
|
|
|
+ *
|
|
|
|
+ jsKind parent_kind = JSTAG_CLASS;
|
|
|
|
+
|
|
|
|
+ *
|
|
|
|
+ * if we're creating a function (and not a method),
|
|
|
|
+ * guess we're inside another function
|
|
|
|
+ *
|
|
|
|
+ if (kind == JSTAG_FUNCTION)
|
|
|
|
+ parent_kind = JSTAG_FUNCTION;
|
|
|
|
+
|
|
|
|
+ e.extensionFields.scope[0] = JsKinds [parent_kind].name;
|
|
|
|
+ e.extensionFields.scope[1] = vStringValue (token->scope);
|
2017-03-07 12:05:05 +01:00
|
|
|
+ }
|
2014-10-07 09:46:42 +02:00
|
|
|
+ * makeConstTag (token, kind); *
|
|
|
|
+ makeTagEntry (&e);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+*/
|
|
|
|
+
|
|
|
|
+static void makeJsTag (tokenInfo *const token, const jsKind kind)
|
|
|
|
+{
|
|
|
|
+ if (JsKinds [kind].enabled && ! token->ignoreTag )
|
|
|
|
+ {
|
|
|
|
+ const char *const name = vStringValue (token->string);
|
|
|
|
+ tagEntryInfo e;
|
|
|
|
+ initTagEntry (&e, name);
|
|
|
|
+
|
|
|
|
+ e.lineNumber = token->lineNumber;
|
|
|
|
+ e.filePosition = token->filePosition;
|
|
|
|
+ e.kindName = JsKinds [kind].name;
|
|
|
|
+ e.kind = JsKinds [kind].letter;
|
|
|
|
+
|
|
|
|
+ if ( vStringLength(token->scope) > 0 )
|
|
|
|
+ {
|
|
|
|
+ jsKind parent_kind = JSTAG_CLASS;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * If we're creating a function (and not a method),
|
|
|
|
+ * guess we're inside another function
|
|
|
|
+ */
|
|
|
|
+ if (kind == JSTAG_FUNCTION)
|
|
|
|
+ parent_kind = JSTAG_FUNCTION;
|
|
|
|
+
|
|
|
|
+ e.extensionFields.scope[0] = JsKinds [parent_kind].name;
|
|
|
|
+ e.extensionFields.scope[1] = vStringValue (token->scope);
|
2017-03-07 12:05:05 +01:00
|
|
|
}
|
|
|
|
- makeConstTag (token, kind);
|
2014-10-07 09:46:42 +02:00
|
|
|
+
|
|
|
|
+ makeTagEntry (&e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-07 12:05:05 +01:00
|
|
|
--
|
|
|
|
2.11.0
|
|
|
|
|