Mercurial > vim
comparison src/tag.c @ 16178:a8689ea2e869 v8.1.1094
patch 8.1.1094: long line in tags file causes error
commit https://github.com/vim/vim/commit/5209334c551778fe6f76945f373ee14fcac96f52
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 30 21:41:48 2019 +0100
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, closes https://github.com/vim/vim/issues/4051,
closes #4084)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Mar 2019 21:45:05 +0100 |
parents | 4d7ee5609652 |
children | 848d4c6e391e |
comparison
equal
deleted
inserted
replaced
16177:8ac126587969 | 16178:a8689ea2e869 |
---|---|
1919 } | 1919 } |
1920 #endif | 1920 #endif |
1921 } | 1921 } |
1922 | 1922 |
1923 parse_line: | 1923 parse_line: |
1924 if (vim_strchr(lbuf, NL) == NULL | |
1925 #ifdef FEAT_CSCOPE | |
1926 && !use_cscope | |
1927 #endif | |
1928 ) | |
1929 { | |
1930 // Truncated line, ignore it. Has been reported for | |
1931 // Mozilla JS with extremely long names. | |
1932 if (p_verbose >= 5) | |
1933 { | |
1934 verbose_enter(); | |
1935 msg(_("Ignoring long line in tags file")); | |
1936 verbose_leave(); | |
1937 } | |
1938 #ifdef FEAT_TAG_BINS | |
1939 if (state != TS_LINEAR) | |
1940 { | |
1941 // Avoid getting stuck. | |
1942 linear = TRUE; | |
1943 state = TS_LINEAR; | |
1944 vim_fseek(fp, search_info.low_offset, SEEK_SET); | |
1945 } | |
1946 #endif | |
1947 continue; | |
1948 } | |
1949 | |
1924 /* | 1950 /* |
1925 * Figure out where the different strings are in this line. | 1951 * Figure out where the different strings are in this line. |
1926 * For "normal" tags: Do a quick check if the tag matches. | 1952 * For "normal" tags: Do a quick check if the tag matches. |
1927 * This speeds up tag searching a lot! | 1953 * This speeds up tag searching a lot! |
1928 */ | 1954 */ |
1935 vim_memset(&tagp, 0, sizeof(tagp)); | 1961 vim_memset(&tagp, 0, sizeof(tagp)); |
1936 tagp.tagname = lbuf; | 1962 tagp.tagname = lbuf; |
1937 tagp.tagname_end = vim_strchr(lbuf, TAB); | 1963 tagp.tagname_end = vim_strchr(lbuf, TAB); |
1938 if (tagp.tagname_end == NULL) | 1964 if (tagp.tagname_end == NULL) |
1939 { | 1965 { |
1940 if (vim_strchr(lbuf, NL) == NULL) | |
1941 { | |
1942 /* Truncated line, ignore it. Has been reported for | |
1943 * Mozilla JS with extremely long names. */ | |
1944 if (p_verbose >= 5) | |
1945 { | |
1946 verbose_enter(); | |
1947 msg(_("Ignoring long line in tags file")); | |
1948 verbose_leave(); | |
1949 } | |
1950 #ifdef FEAT_TAG_BINS | |
1951 if (state != TS_LINEAR) | |
1952 { | |
1953 /* Avoid getting stuck. */ | |
1954 linear = TRUE; | |
1955 state = TS_LINEAR; | |
1956 vim_fseek(fp, search_info.low_offset, SEEK_SET); | |
1957 } | |
1958 #endif | |
1959 continue; | |
1960 } | |
1961 | |
1962 /* Corrupted tag line. */ | 1966 /* Corrupted tag line. */ |
1963 line_error = TRUE; | 1967 line_error = TRUE; |
1964 break; | 1968 break; |
1965 } | 1969 } |
1966 | 1970 |