apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr-util/test testrmm.c
Date Tue, 16 Mar 2004 18:17:33 GMT
wrowe       2004/03/16 10:17:33

  Modified:    misc     apr_rmm.c
               test     testrmm.c
  Log:
  Fix a signed/unsigned mismatch that caused an underflow.
  
  Patch by Ahab A. <eabouzou yahoo.com>
  Test by Phillip M Chiasson <gozer apache.org>
  
  PR: 25550
  
  Revision  Changes    Path
  1.23      +1 -1      apr-util/misc/apr_rmm.c
  
  Index: apr_rmm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/misc/apr_rmm.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- apr_rmm.c	13 Feb 2004 09:55:26 -0000	1.22
  +++ apr_rmm.c	16 Mar 2004 18:17:33 -0000	1.23
  @@ -87,7 +87,7 @@
           next = blk->next;
       }
   
  -    if (bestsize - size > sizeof(rmm_block_t)) {
  +    if (bestsize > sizeof(rmm_block_t) + size) {
           struct rmm_block_t *blk = (rmm_block_t*)((char*)rmm->base + best);
           struct rmm_block_t *new = (rmm_block_t*)((char*)rmm->base + best + size);
   
  
  
  
  1.5       +10 -2     apr-util/test/testrmm.c
  
  Index: testrmm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/test/testrmm.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testrmm.c	13 Feb 2004 09:55:26 -0000	1.4
  +++ testrmm.c	16 Mar 2004 18:17:33 -0000	1.5
  @@ -29,7 +29,7 @@
   
   #if APR_HAS_SHARED_MEMORY
   
  -#define FRAG_SIZE 10
  +#define FRAG_SIZE 80
   #define FRAG_COUNT 10
   #define SHARED_SIZE (apr_size_t)(FRAG_SIZE * FRAG_COUNT * sizeof(char*))
   
  @@ -78,7 +78,15 @@
           off[i] = apr_rmm_malloc(rmm, fragsize);
       } 
       fprintf(stdout, "OK\n");
  -
  +    
  +    printf("Checking for out of memory allocation............");
  +    if (apr_rmm_malloc(rmm, FRAG_SIZE * FRAG_COUNT) == 0) {
  +        fprintf(stdout, "OK\n");
  +    }
  +    else {
  +        return APR_EGENERAL;  
  +    }
  +    
       printf("Setting each fragment to a unique value..........");
       for (i = 0; i < FRAG_COUNT; i++) {
           int j;
  
  
  

Mime
View raw message