gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] memory damaged at (system:STRING-MATCH :anykey :verbose)


From: Michael Koehne
Subject: Re: [Gcl-devel] memory damaged at (system:STRING-MATCH :anykey :verbose)
Date: Fri, 2 Jul 2004 06:22:08 +0200
User-agent: Mutt/1.3.28i

Moin Mike Thomas,

> For the record, on Windows 2.6.2 ANSI I get the same problem:

  you might try the same fix - its NOT save to write at str[end]
  the string it might be some in some .o function. The question
  I still have, is why does this not happen with the gclcvs that
  comes shipped with Debian, as the point in regexpr.c did'nt
  change in cvs at for long time - pure luck ? other ./configure
  switches ?

      ./configure --enable-ansi --enable-readline --enable-dynsysgmp

  or is there any other new side effect - that might not only
  trigger string-match ?

lisp/gcl-bakunin/o/regexpr.c - line 129

    if (compiled_regexp ==0) {END_NO_INTERRUPT;RETURN1(make_fixnum(-1));}
    { /* char *str = string->st.st_self;
         char save_c = str[end];
         int ans;
          if (&(str[end])  == (void *)core_end 
              || &(str[end]) == (void *)compiled_regexp) {

          these are just about impossible, and should be the only
          situations where it is not safe to alter str[end]
          during the running of regexec...
          
          there are more situations that just those - kraehe */

      char *str;
      int ans;
          
      str = (char *)malloc(string->st.st_fillp+1);
      bcopy(string->st.st_self, str, string->st.st_fillp);
      str[end]=0;
      ans = regexec(compiled_regexp,str+start,str,end - start);

      if (ans == 0 ) {
          free(str);
          END_NO_INTERRUPT;RETURN1(make_fixnum(-1));
      }
      {int i = -1;
       regexp *r=compiled_regexp;
       while (++i < NSUBEXP)
         { char *p = r->startp[i] ;
           v->fixa.fixa_self[i] = (p == 0 ? -1 : p - str);
           p = r->endp[i] ;
           v->fixa.fixa_self[NSUBEXP+ i] = (p == 0 ? -1 : p - str);}
       free(str);
       END_NO_INTERRUPT;
       RETURN1(make_fixnum(v->fixa.fixa_self[0]));
     }}
  }}              
-- 
  mailto:address@hidden             UNA:+.? 'CED+2+:::Linux:2.4.22'UNZ+1'
  http://www.xml-edifact.org/           CETERUM CENSEO WINDOWS ESSE DELENDAM




reply via email to

[Prev in Thread] Current Thread [Next in Thread]