Loading ...
Sorry, an error occurred while loading the content.
 

[60ad,syn] illegal highligth ID

Expand Messages
  • Muraoka Taro
    I use Windows GUI version of vim 6.0ad. My vim crash sometimes, and I cannot reproduce it systematically. I have checked out the problem, and found function
    Message 1 of 4 , May 1, 2001
      I use Windows GUI version of vim 6.0ad. My vim crash sometimes, and I
      cannot reproduce it systematically. I have checked out the problem, and
      found function syn_id2attr() is called with argument hl_id is 0. It should
      cause memory access violation.

      Attached patch is one of solution for this problem. But I think there is
      other essential solution. Please check it.
      ----
      Muraoka Taro <koron@...>


      diff -cr src.orig/syntax.c src/syntax.c
      *** src.orig/syntax.c Mon Apr 30 04:28:25 2001
      --- src/syntax.c Tue May 1 10:52:06 2001
      ***************
      *** 7607,7612 ****
      --- 7608,7615 ----
      struct hl_group *sgp;

      hl_id = syn_get_final_id(hl_id);
      + if (hl_id <= 0)
      + hl_id = 1;
      sgp = &HL_TABLE()[hl_id - 1]; /* index is ID minus one */

      #ifdef FEAT_GUI
    • Bram Moolenaar
      ... syn_id2attr() shouldn t be called with a zero argument. I found one place where this might happen. Please check if this patch fixes the problem. I can t
      Message 2 of 4 , May 1, 2001
        Muraoka Taro wrote:

        > I use Windows GUI version of vim 6.0ad. My vim crash sometimes, and I
        > cannot reproduce it systematically. I have checked out the problem, and
        > found function syn_id2attr() is called with argument hl_id is 0. It should
        > cause memory access violation.
        >
        > Attached patch is one of solution for this problem. But I think there is
        > other essential solution. Please check it.

        syn_id2attr() shouldn't be called with a zero argument. I found one place
        where this might happen. Please check if this patch fixes the problem. I
        can't reproduce the problem myself.

        *** screen.c~ Sat Apr 28 16:36:09 2001
        --- screen.c Tue May 1 17:59:01 2001
        ***************
        *** 794,800 ****
        #ifdef FEAT_SEARCH_EXTRA
        /* Setup for ":match" highlighting. Disable any previous match */
        match_hl.rm = wp->w_match;
        ! match_hl.attr = syn_id2attr(wp->w_match_id);
        match_hl.buf = buf;
        match_hl.lnum = 0;
        search_hl.buf = buf;
        --- 794,803 ----
        #ifdef FEAT_SEARCH_EXTRA
        /* Setup for ":match" highlighting. Disable any previous match */
        match_hl.rm = wp->w_match;
        ! if (wp->w_match_id == 0)
        ! match_hl.attr = 0;
        ! else
        ! match_hl.attr = syn_id2attr(wp->w_match_id);
        match_hl.buf = buf;
        match_hl.lnum = 0;
        search_hl.buf = buf;

        --
        hundred-and-one symptoms of being an internet addict:
        21. Your dog has its own home page.

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
        \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
      • Vince Negri
        ... This appears to fix my bizarre -O crash, btw.. -- Vince Negri (vnegri@aslnet.co.uk) Application Solutions Ltd. Tel:+44(0)1273-476608
        Message 3 of 4 , May 2, 2001
          Bram wrote:
          > syn_id2attr() shouldn't be called with a zero argument. I found one place
          > where this might happen. Please check if this patch fixes the problem. I
          > can't reproduce the problem myself.

          This appears to fix my "bizarre -O" crash, btw..

          --
          Vince Negri (vnegri@...)
          Application Solutions Ltd. Tel:+44(0)1273-476608 Fax:+44(0)1273-478888

          Legal Disclaimer: Any views expressed by the sender of this message are
          not necessarily those of Application Solutions Ltd. Information in this
          e-mail may be confidential and is for the use of the intended recipient
          only, no mistake in transmission is intended to waive or compromise such
          privilege. Please advise the sender if you receive this e-mail by mistake.
        • Muraoka Taro
          ... Thank you Bram. I understood the syn_id2attr() s policy, and applied your patch. It seems good enough, and must be correct. But need more time to check
          Message 4 of 4 , May 2, 2001
            Bram Moolenaar wrote:

            > syn_id2attr() shouldn't be called with a zero argument. I found one place
            > where this might happen. Please check if this patch fixes the problem. I
            > can't reproduce the problem myself.

            Thank you Bram. I understood the syn_id2attr()'s policy, and applied your
            patch. It seems good enough, and must be correct. But need more time to
            check it. Because I could not reproduce that crash on purpose before patch.
            ----
            Muraoka Taro <koron@...>
          Your message has been successfully submitted and would be delivered to recipients shortly.