Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 46688 invoked from network); 5 Aug 2005 10:43:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Aug 2005 10:43:36 -0000 Received: (qmail 822 invoked by uid 500); 5 Aug 2005 10:43:35 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 792 invoked by uid 500); 5 Aug 2005 10:43:35 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 779 invoked by uid 99); 5 Aug 2005 10:43:35 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 05 Aug 2005 03:43:23 -0700 Received: (qmail 46624 invoked by uid 65534); 5 Aug 2005 10:43:21 -0000 Message-ID: <20050805104321.46623.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r230433 - in /apr/apr-util/trunk: CHANGES misc/apr_rmm.c test/testrmm.c Date: Fri, 05 Aug 2005 10:43:20 -0000 To: commits@apr.apache.org From: jorton@apache.org X-Mailer: svnmailer-1.0.3 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jorton Date: Fri Aug 5 03:43:16 2005 New Revision: 230433 URL: http://svn.apache.org/viewcvs?rev=230433&view=rev Log: * misc/apr_rmm.c (apr_rmm_realloc): Fix offset calculation. * test/testrmm.c (test_rmm): Add test case. Submitted by: Keith Kelleman Modified: apr/apr-util/trunk/CHANGES apr/apr-util/trunk/misc/apr_rmm.c apr/apr-util/trunk/test/testrmm.c Modified: apr/apr-util/trunk/CHANGES URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/CHANGES?rev=230433&r1=230432&r2=230433&view=diff ============================================================================== --- apr/apr-util/trunk/CHANGES (original) +++ apr/apr-util/trunk/CHANGES Fri Aug 5 03:43:16 2005 @@ -1,5 +1,8 @@ Changes with APR-util 1.2.0 + *) Fix apr_rmm_realloc() offset calculation bug. [Keith Kelleman + ] + *) Add sqlite3 support to APR DBD. [Rick Keiner ] *) Fix build failure with non-threaded APR on AIX. PR 34655. Modified: apr/apr-util/trunk/misc/apr_rmm.c URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/misc/apr_rmm.c?rev=230433&r1=230432&r2=230433&view=diff ============================================================================== --- apr/apr-util/trunk/misc/apr_rmm.c (original) +++ apr/apr-util/trunk/misc/apr_rmm.c Fri Aug 5 03:43:16 2005 @@ -362,7 +362,7 @@ return 0; } - blk = (rmm_block_t*)((char*)rmm->base + old); + blk = (rmm_block_t*)((char*)rmm->base + old - RMM_BLOCK_SIZE); oldsize = blk->size; memcpy(apr_rmm_addr_get(rmm, this), Modified: apr/apr-util/trunk/test/testrmm.c URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/test/testrmm.c?rev=230433&r1=230432&r2=230433&view=diff ============================================================================== --- apr/apr-util/trunk/test/testrmm.c (original) +++ apr/apr-util/trunk/test/testrmm.c Fri Aug 5 03:43:16 2005 @@ -191,12 +191,37 @@ printf("FAILED\n"); return rv; } + + { + unsigned char *c = entity; + + /* Fill in the region; the first half with zereos, which will + * likely catch the apr_rmm_realloc offset calculation bug by + * making it think the old region was zero length. */ + for (i = 0; i < 100; i++) { + c[i] = (i < 50) ? 0 : i; + } + } + /* now we can realloc off[1] and get many more bytes */ off[0] = apr_rmm_realloc(rmm, entity, SHARED_SIZE - 100); if (off[0] == 0) { printf("FAILED\n"); return APR_EINVAL; } + + { + unsigned char *c = apr_rmm_addr_get(rmm, off[0]); + + /* fill in the region */ + for (i = 0; i < 100; i++) { + if (c[i] != (i < 50 ? 0 : i)) { + printf("FAILED at offset %d: %hx\n", i, c[i]); + return APR_EGENERAL; + } + } + } + fprintf(stdout, "OK\n"); printf("Destroying rmm segment...........................");