summaryrefslogtreecommitdiff
path: root/src/tag.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-30 21:41:48 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-30 21:41:48 +0100
commit5209334c551778fe6f76945f373ee14fcac96f52 (patch)
treebe26502b2993ea8ead7cbcbbabbc8c2e5bfd2cf4 /src/tag.c
parent96428dd4e961332e97d86013a321cedf5fafbed6 (diff)
downloadvim-git-8.1.1094.tar.gz
patch 8.1.1094: long line in tags file causes errorv8.1.1094
Problem: Long line in tags file causes error. Solution: Check for overlong line earlier. (Andy Massimino, closes #4051, closes #4084)
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/tag.c b/src/tag.c
index 20473d111..0f4a70d97 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -1921,6 +1921,32 @@ line_read_in:
}
parse_line:
+ if (vim_strchr(lbuf, NL) == NULL
+#ifdef FEAT_CSCOPE
+ && !use_cscope
+#endif
+ )
+ {
+ // Truncated line, ignore it. Has been reported for
+ // Mozilla JS with extremely long names.
+ if (p_verbose >= 5)
+ {
+ verbose_enter();
+ msg(_("Ignoring long line in tags file"));
+ verbose_leave();
+ }
+#ifdef FEAT_TAG_BINS
+ if (state != TS_LINEAR)
+ {
+ // Avoid getting stuck.
+ linear = TRUE;
+ state = TS_LINEAR;
+ vim_fseek(fp, search_info.low_offset, SEEK_SET);
+ }
+#endif
+ continue;
+ }
+
/*
* Figure out where the different strings are in this line.
* For "normal" tags: Do a quick check if the tag matches.
@@ -1937,28 +1963,6 @@ parse_line:
tagp.tagname_end = vim_strchr(lbuf, TAB);
if (tagp.tagname_end == NULL)
{
- if (vim_strchr(lbuf, NL) == NULL)
- {
- /* Truncated line, ignore it. Has been reported for
- * Mozilla JS with extremely long names. */
- if (p_verbose >= 5)
- {
- verbose_enter();
- msg(_("Ignoring long line in tags file"));
- verbose_leave();
- }
-#ifdef FEAT_TAG_BINS
- if (state != TS_LINEAR)
- {
- /* Avoid getting stuck. */
- linear = TRUE;
- state = TS_LINEAR;
- vim_fseek(fp, search_info.low_offset, SEEK_SET);
- }
-#endif
- continue;
- }
-
/* Corrupted tag line. */
line_error = TRUE;
break;