apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stri...@apache.org
Subject cvs commit: apr/memory/unix apr_pools.c
Date Sat, 05 Oct 2002 12:14:03 GMT
striker     2002/10/05 05:14:03

  Modified:    memory/unix apr_pools.c
  Log:
  Revert wrowes last commit and use casts instead.
  
  'active->first_avail + size' might overflow, whereas
  'active->endp - active->first_avail' can never underflow.
  
  Revision  Changes    Path
  1.186     +4 -3      apr/memory/unix/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
  retrieving revision 1.185
  retrieving revision 1.186
  diff -u -r1.185 -r1.186
  --- apr_pools.c	29 Sep 2002 16:21:52 -0000	1.185
  +++ apr_pools.c	5 Oct 2002 12:14:03 -0000	1.186
  @@ -612,7 +612,7 @@
       active = pool->active;
   
       /* If the active node has enough bytes left, use it. */
  -    if (active->first_avail + size < active->endp) {
  +    if (size < (apr_size_t)(active->endp - active->first_avail)) {
           mem = active->first_avail;
           active->first_avail += size;
   
  @@ -620,7 +620,7 @@
       }
   
       node = active->next;
  -    if (node->first_avail + size < node->endp) {
  +    if (size < (apr_size_t)(node->endp - node->first_avail)) {
           *node->ref = node->next;
           node->next->ref = node->ref;
       }
  @@ -925,7 +925,8 @@
           size = APR_PSPRINTF_MIN_STRINGSIZE;
   
       node = active->next;
  -    if (!ps->got_a_new_node && (node->first_avail + size < node->endp))
{
  +    if (!ps->got_a_new_node
  +        && size < (apr_size_t)(node->endp - node->first_avail)) {
           *node->ref = node->next;
           node->next->ref = node->ref;
   
  
  
  

Mime
View raw message