aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tag.c
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2019-04-01 01:50:01 +0200
committerMarco Hinz <mh.codebro@gmail.com>2019-04-02 22:20:53 +0200
commite05a47f68b84fb4318959d9563f865f63ef5fa4d (patch)
treeaa401895d141e470934c16232c019cd10c45254e /src/nvim/tag.c
parent2a73549ee8633afa817cc49fd691dc0ed3e67cf4 (diff)
downloadrneovim-e05a47f68b84fb4318959d9563f865f63ef5fa4d.tar.gz
rneovim-e05a47f68b84fb4318959d9563f865f63ef5fa4d.tar.bz2
rneovim-e05a47f68b84fb4318959d9563f865f63ef5fa4d.zip
vim-patch:8.1.1094: long line in tags file causes error
Problem: Long line in tags file causes error. Solution: Check for overlong line earlier. (Andy Massimino) https://github.com/vim/vim/commit/5209334c551778fe6f76945f373ee14fcac96f52
Diffstat (limited to 'src/nvim/tag.c')
-rw-r--r--src/nvim/tag.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index bc425ab6d4..c2254e2416 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -1527,36 +1527,32 @@ line_read_in:
}
parse_line:
- /*
- * Figure out where the different strings are in this line.
- * For "normal" tags: Do a quick check if the tag matches.
- * This speeds up tag searching a lot!
- */
- if (orgpat.headlen
- ) {
+ if (vim_strchr(lbuf, NL) == NULL && !use_cscope) {
+ // 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();
+ }
+ if (state != TS_LINEAR) {
+ // Avoid getting stuck.
+ linear = true;
+ state = TS_LINEAR;
+ vim_fseek(fp, search_info.low_offset, SEEK_SET);
+ }
+ continue;
+ }
+
+ // Figure out where the different strings are in this line.
+ // For "normal" tags: Do a quick check if the tag matches.
+ // This speeds up tag searching a lot!
+ if (orgpat.headlen) {
tagp.tagname = lbuf;
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();
- }
- if (state != TS_LINEAR) {
- /* Avoid getting stuck. */
- linear = TRUE;
- state = TS_LINEAR;
- vim_fseek(fp, search_info.low_offset, SEEK_SET);
- }
- continue;
- }
-
- /* Corrupted tag line. */
- line_error = TRUE;
+ if (tagp.tagname_end == NULL) {
+ // Corrupted tag line.
+ line_error = true;
break;
}