/[pcre]/code/trunk/pcretest.c
ViewVC logotype

Diff of /code/trunk/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1150 by zherczeg, Sun Oct 21 06:35:52 2012 UTC revision 1153 by chpe, Sun Oct 21 16:53:57 2012 UTC
# Line 4399  while (!done) Line 4399  while (!done)
4399        }        }
4400  #endif  #endif
4401    
4402    #ifdef SUPPORT_VALGRIND
4403        /* Mark the dbuffer as addressable but undefined again. */
4404        if (dbuffer != NULL)
4405          {
4406          VALGRIND_MAKE_MEM_UNDEFINED(dbuffer, dbuffer_size * CHAR_SIZE);
4407          }
4408    #endif
4409    
4410      /* Allocate a buffer to hold the data line. len+1 is an upper bound on      /* Allocate a buffer to hold the data line. len+1 is an upper bound on
4411         the number of pcre_uchar units that will be needed. */         the number of pcre_uchar units that will be needed. */
4412      if (dbuffer == NULL || (size_t)len >= dbuffer_size)      if (dbuffer == NULL || (size_t)len >= dbuffer_size)
# Line 4820  while (!done) Line 4828  while (!done)
4828        }        }
4829  #endif  #endif
4830    
4831      /* Move the data to the end of the buffer so that a read over the end of      /* If we're compiling with explicit valgrind support, Mark the data from after
4832      the buffer will be seen by valgrind, even if it doesn't cause a crash. If      its end to the end of the buffer as unaddressable, so that a read over the end
4833      we are using the POSIX interface, we must include the terminating zero. */      of the buffer will be seen by valgrind, even if it doesn't cause a crash.
4834        If we're not building with valgrind support, at least move the data to the end
4835        of the buffer so that it might at least cause a crash.
4836        If we are using the POSIX interface, we must include the terminating zero. */
4837    
4838      bptr = dbuffer;      bptr = dbuffer;
4839    
4840  #if !defined NOPOSIX  #if !defined NOPOSIX
4841      if (posix || do_posix)      if (posix || do_posix)
4842        {        {
4843    #ifdef SUPPORT_VALGRIND
4844          VALGRIND_MAKE_MEM_NOACCESS(dbuffer + len + 1, dbuffer_size - (len + 1));
4845    #else
4846        memmove(bptr + dbuffer_size - len - 1, bptr, len + 1);        memmove(bptr + dbuffer_size - len - 1, bptr, len + 1);
4847        bptr += dbuffer_size - len - 1;        bptr += dbuffer_size - len - 1;
4848    #endif
4849        }        }
4850      else      else
4851  #endif  #endif
4852        {        {
4853    #ifdef SUPPORT_VALGRIND
4854          VALGRIND_MAKE_MEM_NOACCESS(dbuffer + len * CHAR_SIZE, (dbuffer_size - len) * CHAR_SIZE);
4855    #else
4856        bptr = memmove(bptr + (dbuffer_size - len) * CHAR_SIZE, bptr, len * CHAR_SIZE);        bptr = memmove(bptr + (dbuffer_size - len) * CHAR_SIZE, bptr, len * CHAR_SIZE);
4857    #endif
4858        }        }
4859    
4860      if ((all_use_dfa || use_dfa) && find_match_limit)      if ((all_use_dfa || use_dfa) && find_match_limit)

Legend:
Removed from v.1150  
changed lines
  Added in v.1153

  ViewVC Help
Powered by ViewVC 1.1.5