VirtualBox

Changeset 910 in kBuild for trunk/src


Ignore:
Timestamp:
May 24, 2007 3:10:51 AM (18 years ago)
Author:
bird
Message:

Fixed a few potential variable_buffer realloc problems.

Location:
trunk/src/gmakenew
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmakenew/file.c

    r908 r910  
    474474  for (d = old; d != 0; d = d->next)
    475475    {
     476      size_t buffer_offset; /* bird */
    476477      struct dep *new, *d1;
    477478      char *p;
     
    485486      if (! d->need_2nd_expansion)
    486487        {
    487           size_t l;                         /* bird */
    488488          p = variable_expand ("");
    489           l = p - variable_buffer;          /* bird */
     489          buffer_offset = p - variable_buffer;
    490490          variable_buffer_output (p, d->name, strlen (d->name) + 1);
    491           p = variable_buffer + l;          /* bird - this may have been reallocated! */
     491          p = variable_buffer + buffer_offset; /* bird - variable_buffer may have been reallocated. (observed it) */
    492492        }
    493493      else
     
    499499              char *o;
    500500              char *buffer = variable_expand ("");
     501              buffer_offset = buffer - variable_buffer; /* bird */
    501502
    502503              o = subst_expand (buffer, d->name, "%", "$*", 1, 2, 0);
     504              buffer = variable_buffer + buffer_offset; /* bird - variable_buffer may have been reallocated. */
    503505
    504506              d->name = strcache_add_len (buffer, o - buffer);
     
    538540          const char *pattern = "%";
    539541          char *buffer = variable_expand ("");
     542          const size_t buffer_offset = buffer - variable_buffer; /* bird */
    540543          struct dep *dp = new, *dl = 0;
    541544
     
    562565                    o = patsubst_expand_pat (buffer, d->stem, pattern, nm,
    563566                                             pattern+1, percent+1);
     567                  buffer = variable_buffer + buffer_offset; /* bird - variable_buffer may have been reallocated. */
     568
    564569
    565570                  /* If the name expanded to the empty string, ignore it.  */
  • trunk/src/gmakenew/read.c

    r903 r910  
    21862186          static const char *percent = "%";
    21872187          char *buffer = variable_expand ("");
     2188          const size_t buffer_offset = buffer - variable_buffer; /* bird */
    21882189          char *o = patsubst_expand_pat (buffer, name, pattern, percent,
    21892190                                         pattern_percent+1, percent+1);
     2191          buffer = variable_buffer + buffer_offset; /* bird - variable_buffer may have been reallocated. */
    21902192          f->stem = strcache_add_len (buffer, o - buffer);
    21912193          if (this)
  • trunk/src/gmakenew/remake.c

    r903 r910  
    809809#ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL
    810810  /* update not_parallel if the file was flagged for that. */
    811   if (   ran 
    812       && (file->command_flags & (COMMANDS_NOTPARALLEL | COMMANDS_NO_COMMANDS)) 
     811  if (   ran
     812      && (file->command_flags & (COMMANDS_NOTPARALLEL | COMMANDS_NO_COMMANDS))
    813813         == COMMANDS_NOTPARALLEL)
    814814    {
     
    15031503      static int libdir_maxlen = -1;
    15041504      char *libbuf = variable_expand ("");
     1505      const size_t libbuf_offset = libbuf - variable_buffer; /* bird */
    15051506
    15061507      /* Expand the pattern using LIBNAME as a replacement.  */
     
    15251526        p4 = variable_buffer_output (p4, p3+1, len - (p3-p));
    15261527        p[len] = c;
     1528        libbuf = variable_buffer + libbuf_offset; /* bird - variable_buffer may have been reallocated. */
    15271529      }
    15281530
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette