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

VIM crashes in one extreme situation

Expand Messages
  • Fan Decheng
    I crashed vim with the following practice. Platform: Microsoft Windows 2000 SP4. Program: GVIM. --text begin-- /// /// ��Ӹ����¶�ҵ�����˱���
    Message 1 of 19 , Feb 23 7:08 PM
    • 0 Attachment
      I crashed vim with the following practice.
      Platform: Microsoft Windows 2000 SP4. Program: GVIM.
      --text begin--
      /// <summary>
      /// 添加个人月度业绩考核报表
      /// </summary>
      /// <param name="entity">个人月度业绩考核报表</param>
      /// <returns>新记录的 ID</returns>
      public int AddMAR(MAREntity entity)
      {
      DataSet ds;
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARYear", entity.MARYear);
      paramBox.Push("@MARMonth", entity.MARMonth);
      paramBox.Push("@UserID", entity.UserID);
      paramBox.Push("@BingJiaDayCount",

      entity.BingJiaDayCount);
      paramBox.Push("@ShiJiaDayCount",

      entity.ShiJiaDayCount);
      paramBox.Push("@JiaBanDayCount",

      entity.JiaBanDayCount);
      paramBox.Push("@QiTaRemarks",

      entity.QiTaRemarks);
      paramBox.Push("@YueHeRenName",

      entity.YueHeRenName);
      paramBox.Push("@PiZhunRenName",

      entity.PiZhunRenName);
      ds =

      DBAccess.ExecuteDataset(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure, "AddMAR",
      paramBox.ToParamArray());
      return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
      }

      /// <summary>
      /// 更新指定 ID 的个人月度业绩考核报表
      /// </summary>
      /// <param name="entity">个人月度业绩考核报表</param>
      public void UpdateMARByID(MAREntity entity)
      {
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARId", entity.MARId);
      paramBox.Push("@MARYear", entity.MARYear);
      paramBox.Push("@MARMonth", entity.MARMonth);
      paramBox.Push("@UserID", entity.UserID);
      paramBox.Push("@BingJiaDayCount",

      entity.BingJiaDayCount);
      paramBox.Push("@ShiJiaDayCount",

      entity.ShiJiaDayCount);
      paramBox.Push("@JiaBanDayCount",

      entity.JiaBanDayCount);
      paramBox.Push("@QiTaRemarks",

      entity.QiTaRemarks);
      paramBox.Push("@YueHeRenName",

      entity.YueHeRenName);
      paramBox.Push("@PiZhunRenName",

      entity.PiZhunRenName);


      DBAccess.ExecuteNonQuery(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "UpdateMARByID",
      paramBox.ToParamArray());
      }

      /// <summary>
      /// 删除指定 ID 的个人月度业绩考核报表
      /// </summary>
      /// <param name="id">个人月度业绩考核报表的 ID</param>
      public void DeleteMARByID(int id)
      {
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARId", id);


      DBAccess.ExecuteNonQuery(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "DeleteMARByID",
      paramBox.ToParamArray());
      }

      /// <summary>
      /// 获取指定 ID 的个人月度业绩考核报表
      /// </summary>
      /// <param name="id">个人月度业绩考核报表的 ID</param>
      /// <returns>个人月度业绩考核报表</returns>
      public DataSet GetMARByID(int id)
      {
      DataSet ds;
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARId", id);
      ds =

      DBAccess.ExecuteDataset(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "GetMARByID",
      paramBox.ToParamArray());
      return ds;
      }

      /// <summary>
      /// 添加个人月度业绩考核报表记录
      /// </summary>
      /// <param

      name="entity">个人月度业绩考核报表记录</param>
      /// <returns>新记录的 ID</returns>
      public int AddMARRecord(MARRecordEntity entity)
      {
      DataSet ds;
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@ProjectName",

      entity.ProjectName);
      paramBox.Push("@WorkKind", entity.WorkKind);
      paramBox.Push("@WorkResponsibility",

      entity.WorkResponsibility);
      paramBox.Push("@WorkStatus", entity.WorkStatus);
      paramBox.Push("@WorkAmount", entity.WorkAmount);
      paramBox.Push("@WorkQuality",

      entity.WorkQuality);
      paramBox.Push("@DeWorkKind", entity.DeWorkKind);
      paramBox.Push("@DeWorkResponsibility",

      entity.DeWorkResponsibility);
      paramBox.Push("@DeWorkStatus",

      entity.DeWorkStatus);
      paramBox.Push("@DeWorkAmount",

      entity.DeWorkAmount);
      paramBox.Push("@DeWorkQuality",

      entity.DeWorkQuality);
      paramBox.Push("@MARId", entity.MARId);
      ds =

      DBAccess.ExecuteDataset(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "AddMARRecord",
      paramBox.ToParamArray());
      return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
      }

      /// <summary>
      /// 更新指定 ID 的个人月度业绩考核报表记录
      /// </summary>
      /// <param

      name="entity">个人月度业绩考核报表记录</param>
      public void UpdateMARRecordByID(MARRecordEntity entity)
      {
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARRecordId",

      entity.MARRecordId);
      paramBox.Push("@ProjectName",

      entity.ProjectName);
      paramBox.Push("@WorkKind", entity.WorkKind);
      paramBox.Push("@WorkResponsibility",

      entity.WorkResponsibility);
      paramBox.Push("@WorkStatus", entity.WorkStatus);
      paramBox.Push("@WorkAmount", entity.WorkAmount);
      paramBox.Push("@WorkQuality",

      entity.WorkQuality);
      paramBox.Push("@DeWorkKind", entity.DeWorkKind);
      paramBox.Push("@DeWorkResponsibility",

      entity.DeWorkResponsibility);
      paramBox.Push("@DeWorkStatus",

      entity.DeWorkStatus);
      paramBox.Push("@DeWorkAmount",

      entity.DeWorkAmount);
      paramBox.Push("@DeWorkQuality",

      entity.DeWorkQuality);
      paramBox.Push("@MARId", entity.MARId);


      DBAccess.ExecuteNonQuery(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "UpdateMARRecordByID",
      paramBox.ToParamArray());
      }

      /// <summary>
      /// 删除指定 ID 的个人月度业绩考核报表记录
      /// </summary>
      /// <param name="id">个人月度业绩考核报表记录的

      ID</param>
      public void DeleteMARRecordByID(int id)
      {
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARRecordId", id);


      DBAccess.ExecuteNonQuery(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "DeleteMARRecordByID",
      paramBox.ToParamArray());
      }

      /// <summary>
      /// 获取指定 ID 的个人月度业绩考核报表记录
      /// </summary>
      /// <param name="id">个人月度业绩考核报表记录的

      ID</param>
      /// <returns>个人月度业绩考核报表记录</returns>
      public DataSet GetMARRecordByID(int id)
      {
      DataSet ds;
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARRecordId", id);
      ds =

      DBAccess.ExecuteDataset(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "GetMARRecordByID",
      paramBox.ToParamArray());
      return ds;
      }

      /// <summary>
      /// 获取指定年月人的个人月度业绩考核报表
      /// </summary>
      /// <param name="year">年</param>
      /// <param name="month">月</param>
      /// <param name="userID">用户ID</param>
      /// <returns>个人月度业绩考核报表</returns>
      public DataSet GetMARByYMU(int id)
      {
      DataSet ds;
      DBParamBox paramBox = new DBParamBox();
      paramBox.Push("@MARYear", year);
      paramBox.Push("@MARMonth", month);
      paramBox.Push("@MARUserID", userID);
      ds =

      DBAccess.ExecuteDataset(ConfigKey.DATABASE_CONNECTION_KEY,
      CommandType.StoredProcedure,

      "GetMARByYMU",
      paramBox.ToParamArray());
      return ds;
      }
      --text end--
      Copy the text above, and then use "+P to paste it into gvim.
      Use <G to unindent twice. Run the command below:
      :%s/^{\(.\|\n\)*\n}//gc
      Result: crash.

      p.s. I made the wrong substitute command. Actually it should be:
      :%s/^{\([^}]\|\n\)*\n}/{\r}/gc
    • Mathias Michaelis
      Fan Decheng wrotes ... This can be reduced to some less extreme condition. I observe the following under the following conditions: vim AND gvim 6.3.62 Windows
      Message 2 of 19 , Feb 24 3:09 AM
      • 0 Attachment
        Fan Decheng wrotes

        > I crashed vim with the following practice.
        > Platform: Microsoft Windows 2000 SP4. Program: GVIM.
        > --text begin--
        > [ long long text]
        > --text end--
        >
        > Use ...
        > :%s/^{\(.\|\n\)*\n}//gc
        > Result: crash.
        >
        This can be reduced to some less extreme condition. I observe the
        following under the following conditions:

        vim AND gvim 6.3.62
        Windows XP SP 2

        1) I create a text file containing an 'A' on the first line,
        followed by 34 lines each containing 80 letters 'x'. On the last
        line there is a single 'B'. This means:

        A
        xxxxxx ... xxxx
        xxxxxx ... xxxx
        ...............
        xxxxxx ... xxxx
        B

        2) I save this file, go into a cmd window (dos window) and enter

        vim -u NONE filename.txt

        or

        gvim -u NONE filename.txt

        3) If I enter

        /^A\(.\|\n\)*\nB

        then vim terminates immediately after hitting the <CR> key.

        4) If I clear up any .swp file, open the text file again, delete on
        line and repeat the search command, now it works.

        5) If I, yet in vim/gvim, do a

        set hlsearch

        the whole text is highlighted.

        6) If I open a new line between the { and } line with o, i can yet
        insert 35 letters 'x'. Every 'x' is highlighted. Then, when I
        type the 36th letter 'x', (g)vim terminates immediately.

        With kind regards
        Mathias
      • Bram Moolenaar
        ... [...] ... I get a E361: Crash intercepted; regexp too complex? error. Are you using Vim 6.2? Code to catch this out of stack error was added in
        Message 3 of 19 , Feb 24 3:10 AM
        • 0 Attachment
          Fan Decheng wrote:

          > I crashed vim with the following practice.
          > Platform: Microsoft Windows 2000 SP4. Program: GVIM.
          > --text begin--
          [...]
          > --text end--
          > Copy the text above, and then use "+P to paste it into gvim.
          > Use <G to unindent twice. Run the command below:
          > :%s/^{\(.\|\n\)*\n}//gc
          > Result: crash.

          I get a "E361: Crash intercepted; regexp too complex?" error.
          Are you using Vim 6.2? Code to catch this "out of stack" error was
          added in 6.2.230, thus it's not in 6.2, it is in 6.3.

          --
          hundred-and-one symptoms of being an internet addict:
          198. You read all the quotes at Netaholics Anonymous and keep thinking
          "What's wrong with that?"

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
          \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
        • Mathias Michaelis
          ... ups - between the A and B line of course -- sorry! Mathias
          Message 4 of 19 , Feb 24 3:15 AM
          • 0 Attachment
            > 6) If I open a new line between the { and } line with o
            >
            ups - between the A and B line of course -- sorry!
            Mathias
          • Mathias Michaelis
            ... To crash it is enough to enter / (. | n )*. Here is a yet simpler experiment: Make a text file consisting of one simple line of at least 3616 letters x ,
            Message 5 of 19 , Feb 24 4:27 AM
            • 0 Attachment
              > 3) If I enter
              >
              > /^A\(.\|\n\)*\nB
              >
              > then vim terminates immediately after hitting the <CR> key.
              >
              To crash it is enough to enter /\(.\|\n\)*.

              Here is a yet simpler experiment:

              Make a text file consisting of one simple line of at least 3616
              letters 'x', open the file with vim or gvim and type

              /.*
              /\(.*\)
              /\(.\)*

              The first two search commands will work, the third one will crash.
              If however the line contains only 3615 letters 'x', then the third
              search command will work two.

              From here I conclude that the number of \(\) within a regular
              expression must not exceed the limit of 3615.

              Regards
              Mathias
            • Mathias Michaelis
              ... Well, it s not as simple as I thought. Here is a list of regular expressions and the maximal numbers of matching subexpressions ( ) within a single line
              Message 6 of 19 , Feb 24 5:44 AM
              • 0 Attachment
                > From here I conclude that the number of \(\) within a regular
                > expression must not exceed the limit of 3615.
                >
                Well, it's not as simple as I thought. Here is a list of regular
                expressions and the maximal numbers of matching subexpressions \(\)
                within a single line of 'x' that are allowed. If more than that
                number of subexpression is found in the xxx-line, (g)vim 6.3.62
                under Windows XP crashes

                /\(.\)* 3615
                /\(x\)* 3615
                /\(x\|y\)* 2711 (Fan Decheng's case)
                /\(x\|y\|z\)* 2711
                /\(x\|y\|z\|t\)* 2711
                /\([xyzt]\)* 3615
                /\(x\{1,2}\)* 2711
                /\(x\{1,2}\|y\)* 2168
                /\(x\|y\{1,2}\)* 2711

                > Regards
                > Mathias
                >
              • Bram Moolenaar
                ... Strange, for me the error is caught and I get an error message. I tried adding and deleting x characters until at the edge of where the pattern is
                Message 7 of 19 , Feb 24 5:45 AM
                • 0 Attachment
                  Mathias Michaelis wrote:

                  > This can be reduced to some less extreme condition. I observe the
                  > following under the following conditions:
                  >
                  > vim AND gvim 6.3.62
                  > Windows XP SP 2
                  >
                  > 1) I create a text file containing an 'A' on the first line,
                  > followed by 34 lines each containing 80 letters 'x'. On the last
                  > line there is a single 'B'. This means:
                  >
                  > A
                  > xxxxxx ... xxxx
                  > xxxxxx ... xxxx
                  > ...............
                  > xxxxxx ... xxxx
                  > B
                  >
                  > 2) I save this file, go into a cmd window (dos window) and enter
                  >
                  > vim -u NONE filename.txt
                  >
                  > or
                  >
                  > gvim -u NONE filename.txt
                  >
                  > 3) If I enter
                  >
                  > /^A\(.\|\n\)*\nB
                  >
                  > then vim terminates immediately after hitting the <CR> key.

                  Strange, for me the error is caught and I get an error message. I tried
                  adding and deleting 'x' characters until at the edge of where the
                  pattern is matched and the error occurs. There is no situation that Vim
                  crashes.

                  Is there a situation where the __try / __except mechanism does not work?
                  Did you use a Vim not compiled with MSVC perhaps?

                  --
                  hundred-and-one symptoms of being an internet addict:
                  203. You're an active member of more than 20 newsgroups.

                  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                  \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                  \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
                • Mathias Michaelis
                  Bram Moolenaar wrote ... I think so. I am using Tonies Version of vim, available under http://users.skynet.be/antoine.mechelynck/vim/#ajm If I do a :version I
                  Message 8 of 19 , Feb 24 5:50 AM
                  • 0 Attachment
                    Bram Moolenaar wrote

                    > Is there a situation where the __try / __except mechanism does
                    > not work? Did you use a Vim not compiled with MSVC perhaps?
                    >
                    I think so. I am using Tonies Version of vim, available under

                    http://users.skynet.be/antoine.mechelynck/vim/#ajm

                    If I do a :version I get among other things

                    compiled: gcc -O3 -fomit ...
                    linked: gcc -s -o gvim.exe ...

                    With kind regards
                    Mathias
                  • Vince Negri
                    Stranger... for me, there isn t even an error message, the match is found ok. 6.3.53 on Win2k ... Legal Disclaimer: Any views expressed by the sender of this
                    Message 9 of 19 , Feb 24 5:55 AM
                    • 0 Attachment
                      Stranger... for me, there isn't even an error message, the match is found
                      ok.

                      6.3.53 on Win2k

                      > -----Original Message-----
                      > From: Bram Moolenaar [SMTP:Bram@...]
                      > Sent: Thursday, February 24, 2005 1:45 PM
                      > To: Mathias Michaelis
                      > Cc: vim-dev@...
                      > Subject: Re: VIM crashes in one extreme situation
                      >
                      >
                      > Mathias Michaelis wrote:
                      >
                      > > This can be reduced to some less extreme condition. I observe the
                      > > following under the following conditions:
                      > >
                      > > vim AND gvim 6.3.62
                      > > Windows XP SP 2
                      > >
                      > > 1) I create a text file containing an 'A' on the first line,
                      > > followed by 34 lines each containing 80 letters 'x'. On the last
                      > > line there is a single 'B'. This means:
                      > >
                      > > A
                      > > xxxxxx ... xxxx
                      > > xxxxxx ... xxxx
                      > > ...............
                      > > xxxxxx ... xxxx
                      > > B
                      > >
                      > > 2) I save this file, go into a cmd window (dos window) and enter
                      > >
                      > > vim -u NONE filename.txt
                      > >
                      > > or
                      > >
                      > > gvim -u NONE filename.txt
                      > >
                      > > 3) If I enter
                      > >
                      > > /^A\(.\|\n\)*\nB
                      > >
                      > > then vim terminates immediately after hitting the <CR> key.
                      >
                      > Strange, for me the error is caught and I get an error message. I tried
                      > adding and deleting 'x' characters until at the edge of where the
                      > pattern is matched and the error occurs. There is no situation that Vim
                      > crashes.
                      >
                      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.
                    • Mathias Michaelis
                      Hello Vince ... Open vim or gvim and try 10000ix / (. | n )* If this works, try it once more with more lines of length 10.000. Perhaps the limit when
                      Message 10 of 19 , Feb 24 6:05 AM
                      • 0 Attachment
                        Hello Vince

                        > Stranger... for me, there isn't even an error message, the match
                        > is found ok.
                        >
                        > 6.3.53 on Win2k
                        >
                        Open vim or gvim and try

                        10000ix<esc>
                        /\(.\|\n\)*

                        If this works, try it once more with more lines of length 10.000.
                        Perhaps the limit when (g)vim crashes or gives an error message vary
                        from system to system.

                        With kind regards,
                        Mathias
                      • Vince Negri
                        Ok, trying that example I get the pattern caused out-of-stack error message, same as Bram. It looks like antoine s build (done with win32 gcc) doesn t
                        Message 11 of 19 , Feb 24 6:09 AM
                        • 0 Attachment
                          Ok, trying that example I get the
                          "pattern caused out-of-stack error" message, same as
                          Bram.

                          It looks like antoine's build (done with win32 gcc) doesn't
                          support the stack checking.

                          > -----Original Message-----
                          > From: Mathias Michaelis [SMTP:michaelis@...]
                          > Sent: Thursday, February 24, 2005 2:05 PM
                          > To: vim-dev@...
                          > Subject: Re: VIM crashes in one extreme situation
                          >
                          > Hello Vince
                          >
                          > > Stranger... for me, there isn't even an error message, the match
                          > > is found ok.
                          > >
                          > > 6.3.53 on Win2k
                          > >
                          > Open vim or gvim and try
                          >
                          > 10000ix<esc>
                          > /\(.\|\n\)*
                          >
                          > If this works, try it once more with more lines of length 10.000.
                          > Perhaps the limit when (g)vim crashes or gives an error message vary
                          > from system to system.
                          >
                          > With kind regards,
                          > Mathias
                          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.
                        • Alejandro López-Valencia
                          ... An optimization bug in gcc s Mingw port perhaps? I can confirm that my home-brewed native win32 binaries present the same crash both vim 6.3.52 and a very
                          Message 12 of 19 , Feb 24 7:30 AM
                          • 0 Attachment
                            Vince Negri wrote:
                            > Ok, trying that example I get the
                            > "pattern caused out-of-stack error" message, same as
                            > Bram.
                            >
                            > It looks like antoine's build (done with win32 gcc) doesn't
                            > support the stack checking.

                            An optimization bug in gcc's Mingw port perhaps?

                            I can confirm that my home-brewed native win32 binaries present the same
                            crash both vim 6.3.52 and a very recent vim7 snapshot. Therefore there
                            is a problem with the Mingw GCC distributed with Cygwin (3.3.3 + extra
                            mods), which is what I have. We can rule out a problem with GNU
                            binutils, because the Cygwin binaries (that is, linked to the POSIX
                            emulation library that uses the newlib C runtime) give an out of bounds
                            error as expected, yet were created with the same linker.

                            Now we need some one who is using Mingw 3.4 out there to confirm if
                            he/she has the bug as well.

                            _________________________________________________________
                            Do You Yahoo!?
                            Información de Estados Unidos y América Latina, en Yahoo! Noticias.
                            Visítanos en http://noticias.espanol.yahoo.com
                          • Bram Moolenaar
                            ... That explains why __try isn t used. From os_win32.h: #if defined(_MSC_VER) || defined(__BORLANDC__) /* Support for __try / __except. All versions of MSVC
                            Message 13 of 19 , Feb 24 8:07 AM
                            • 0 Attachment
                              Mathias Michaelis wrote:

                              > > Is there a situation where the __try / __except mechanism does
                              > > not work? Did you use a Vim not compiled with MSVC perhaps?
                              > >
                              > I think so. I am using Tonies Version of vim, available under
                              >
                              > http://users.skynet.be/antoine.mechelynck/vim/#ajm
                              >
                              > If I do a :version I get among other things
                              >
                              > compiled: gcc -O3 -fomit ...
                              > linked: gcc -s -o gvim.exe ...

                              That explains why __try isn't used. From os_win32.h:

                              #if defined(_MSC_VER) || defined(__BORLANDC__)
                              /* Support for __try / __except. All versions of MSVC and Borland C are
                              * expected to have this. Any other compilers that support it? */
                              # define HAVE_TRY_EXCEPT 1

                              Assuming that gcc doesn't support __try, we can maybe use longjmp()?
                              The code currently is in os_unix.c, it could be moved to a common file.
                              Someone who wants to try this? First check if the setjmp.h include file
                              exists.

                              --
                              hundred-and-one symptoms of being an internet addict:
                              207. You're given one phone call in prison and you ask them for a laptop.

                              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                              /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                              \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                              \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
                            • Antoine J. Mechelynck
                              ... Does the bug appear identically in vim.exe / gvim.exe on the one hand (non-debug builds) and in vimd.exe / gvimd.exe on the other hand (debug builds)? If
                              Message 14 of 19 , Feb 24 9:18 AM
                              • 0 Attachment
                                Alejandro López-Valencia wrote:
                                > Vince Negri wrote:
                                >
                                >>Ok, trying that example I get the
                                >>"pattern caused out-of-stack error" message, same as
                                >>Bram.
                                >>
                                >>It looks like antoine's build (done with win32 gcc) doesn't
                                >>support the stack checking.
                                >
                                >
                                > An optimization bug in gcc's Mingw port perhaps?
                                >
                                > I can confirm that my home-brewed native win32 binaries present the same
                                > crash both vim 6.3.52 and a very recent vim7 snapshot. Therefore there
                                > is a problem with the Mingw GCC distributed with Cygwin (3.3.3 + extra
                                > mods), which is what I have. We can rule out a problem with GNU
                                > binutils, because the Cygwin binaries (that is, linked to the POSIX
                                > emulation library that uses the newlib C runtime) give an out of bounds
                                > error as expected, yet were created with the same linker.
                                >
                                > Now we need some one who is using Mingw 3.4 out there to confirm if
                                > he/she has the bug as well.

                                Does the bug appear identically in vim.exe / gvim.exe on the one hand
                                (non-debug builds) and in vimd.exe / gvimd.exe on the other hand (debug
                                builds)? If there is an optimization bug, it is possible that it appears
                                only in the non-debug builds since IIUC the debug builds are slightly
                                less speed-optimized, for the sake of traceability.

                                Best regards,
                                Tony.
                              • Mathias Michaelis
                                Tony ... As a simple 5000ix / (x )* shows, the bug appears in any (g)vim(d).exe from your site. It looks ... With kind regards (and thanks for compiling
                                Message 15 of 19 , Feb 24 9:33 AM
                                • 0 Attachment
                                  Tony

                                  > Does the bug appear identically in vim.exe / gvim.exe on the one hand
                                  > (non-debug builds) and in vimd.exe / gvimd.exe on the other hand (debug
                                  > builds)?
                                  >
                                  As a simple

                                  5000ix<esc>
                                  /\(x\)*

                                  shows, the bug appears in any (g)vim(d).exe from your site. It looks
                                  like Bram already has found the reason for this:

                                  > That explains why __try isn't used. From os_win32.h:
                                  >
                                  > #if defined(_MSC_VER) || defined(__BORLANDC__)
                                  > /* Support for __try / __except. All versions of MSVC and Borland C are
                                  > * expected to have this. Any other compilers that support it? */
                                  > # define HAVE_TRY_EXCEPT 1
                                  >
                                  > Assuming that gcc doesn't support __try, we can maybe use longjmp()?
                                  > The code currently is in os_unix.c, it could be moved to a common file.
                                  > Someone who wants to try this? First check if the setjmp.h include file
                                  > exists.
                                  >
                                  With kind regards
                                  (and thanks for compiling vim for windows)

                                  Mathias
                                • Alejandro López-Valencia
                                  ... Yes. Mingw supports longjmp(), at least the runtime version I have available (the latest, btw). I can t commit to move the longjmp code to a different file
                                  Message 16 of 19 , Feb 28 1:49 PM
                                  • 0 Attachment
                                    Bram Moolenaar wrote:
                                    > Mathias Michaelis wrote:
                                    >>If I do a :version I get among other things
                                    >>
                                    >>compiled: gcc -O3 -fomit ...
                                    >>linked: gcc -s -o gvim.exe ...
                                    >
                                    >
                                    > That explains why __try isn't used. From os_win32.h:
                                    >
                                    > #if defined(_MSC_VER) || defined(__BORLANDC__)
                                    > /* Support for __try / __except. All versions of MSVC and Borland C are
                                    > * expected to have this. Any other compilers that support it? */
                                    > # define HAVE_TRY_EXCEPT 1
                                    >
                                    > Assuming that gcc doesn't support __try, we can maybe use longjmp()?
                                    > The code currently is in os_unix.c, it could be moved to a common file.
                                    > Someone who wants to try this? First check if the setjmp.h include file
                                    > exists.

                                    Yes. Mingw supports longjmp(), at least the runtime version I have
                                    available (the latest, btw). I can't commit to move the longjmp code to
                                    a different file soon, but I'll try (if anyone beats me to it, please do
                                    and receive my eternal gratitude :-).

                                    _________________________________________________________
                                    Do You Yahoo!?
                                    Información de Estados Unidos y América Latina, en Yahoo! Noticias.
                                    Visítanos en http://noticias.espanol.yahoo.com
                                  • Bram Moolenaar
                                    ... I just tried using longjmp() yesterday. That works, but the problem is that we need to get a signal for the out-of-stack situation, so that we can jump
                                    Message 17 of 19 , Mar 1, 2005
                                    • 0 Attachment
                                      Alejandro Lopez Valencia wrote:

                                      > Bram Moolenaar wrote:
                                      > > Mathias Michaelis wrote:
                                      > >>If I do a :version I get among other things
                                      > >>
                                      > >>compiled: gcc -O3 -fomit ...
                                      > >>linked: gcc -s -o gvim.exe ...
                                      > >
                                      > >
                                      > > That explains why __try isn't used. From os_win32.h:
                                      > >
                                      > > #if defined(_MSC_VER) || defined(__BORLANDC__)
                                      > > /* Support for __try / __except. All versions of MSVC and Borland C are
                                      > > * expected to have this. Any other compilers that support it? */
                                      > > # define HAVE_TRY_EXCEPT 1
                                      > >
                                      > > Assuming that gcc doesn't support __try, we can maybe use longjmp()?
                                      > > The code currently is in os_unix.c, it could be moved to a common file.
                                      > > Someone who wants to try this? First check if the setjmp.h include file
                                      > > exists.
                                      >
                                      > Yes. Mingw supports longjmp(), at least the runtime version I have
                                      > available (the latest, btw). I can't commit to move the longjmp code to
                                      > a different file soon, but I'll try (if anyone beats me to it, please do
                                      > and receive my eternal gratitude :-).

                                      I just tried using longjmp() yesterday. That works, but the problem is
                                      that we need to get a signal for the out-of-stack situation, so that we
                                      can jump somewhere. But we don't seem to have a chance to catch the
                                      signal. At least, I could not see it happen.

                                      I looked around for another solution and found some code to simulate
                                      __try with MingW. It is using assembly code... There is also __try1
                                      and __except1 in the MingW header files, but they do not do everything
                                      we need.

                                      I included it in the latest snapshot, but it's disabled. It worked
                                      sometimes, but at least not when the optimizer was enabled. The code is
                                      in src/regexp.c. Define MINGW_TRY to try out the code.

                                      The examples I found with this mechanism are around very simple code.
                                      We do recursive function calls. That might be the reason it doesn't
                                      work for Vim.

                                      If someone has good ideas how to make this work reliably, let's hear it!
                                      Otherwise the only solution is to compile with MSVC.

                                      --
                                      hundred-and-one symptoms of being an internet addict:
                                      264. You turn to the teletext page "surfing report" and are surprised that it
                                      is about sizes of waves and a weather forecast for seaside resorts.

                                      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                                      \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
                                    • George V. Reilly
                                      ... Unbounded recursion is a really bad idea. (I assume that s the underlying problem.) Why not explicitly manage the recursion state on a custom stack,
                                      Message 18 of 19 , Mar 1, 2005
                                      • 0 Attachment
                                        Bram Moolenaar wrote:

                                        >The examples I found with this mechanism are around very simple code.
                                        >We do recursive function calls. That might be the reason it doesn't
                                        >work for Vim.
                                        >
                                        >If someone has good ideas how to make this work reliably, let's hear it!
                                        >Otherwise the only solution is to compile with MSVC.
                                        >
                                        >

                                        Unbounded recursion is a really bad idea. (I assume that's the
                                        underlying problem.) Why not explicitly manage the recursion state on a
                                        custom stack, instead of implicitly on the system stack?

                                        --
                                        George V. Reilly george@...
                                        America is the only nation in history which miraculously has gone
                                        directly from barbarism to degeneration without the usual interval
                                        of civilization.
                                        -- George Clemenceau (1841-1929)
                                        -- Oscar Wilde (1854-1900)
                                        (Get Witty Auto-Generated Signatures from http://SmartBee.org)
                                      • Bram Moolenaar
                                        ... We would still run out of stack. Or do you mean that we would know how large the stack is and we can check that it s almost full? We actually already
                                        Message 19 of 19 , Mar 1, 2005
                                        • 0 Attachment
                                          George Reilly wrote:

                                          > Bram Moolenaar wrote:
                                          >
                                          > >The examples I found with this mechanism are around very simple code.
                                          > >We do recursive function calls. That might be the reason it doesn't
                                          > >work for Vim.
                                          > >
                                          > >If someone has good ideas how to make this work reliably, let's hear it!
                                          > >Otherwise the only solution is to compile with MSVC.
                                          >
                                          > Unbounded recursion is a really bad idea. (I assume that's the
                                          > underlying problem.) Why not explicitly manage the recursion state on a
                                          > custom stack, instead of implicitly on the system stack?

                                          We would still run out of stack. Or do you mean that we would know how
                                          large the stack is and we can check that it's almost full? We actually
                                          already have code for that: mch_stackcheck(). But it can only be used
                                          if we know how big the stack is, therefore it's only used when
                                          getrlimit() is present.

                                          Thus if you know a way to figure out the size of the stack, we can use
                                          that solution.

                                          An ever better solution would be to change the regexp code from using
                                          recursive calls to a linear approach. But that means rewriting most of
                                          the complex regexp code...

                                          --
                                          GALAHAD: Camelot ...
                                          LAUNCELOT: Camelot ...
                                          GAWAIN: It's only a model.
                                          "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                                          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                          /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                          \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                                          \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
                                        Your message has been successfully submitted and would be delivered to recipients shortly.