You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2005/08/05 13:03:06 UTC
svn commit: r230442 - in /apr/apr-util/branches/1.1.x: CHANGES
misc/apr_rmm.c test/testrmm.c
Author: jorton
Date: Fri Aug 5 04:03:03 2005
New Revision: 230442
URL: http://svn.apache.org/viewcvs?rev=230442&view=rev
Log:
Merge r230433 from trunk:
* misc/apr_rmm.c (apr_rmm_realloc): Fix offset calculation.
* test/testrmm.c (test_rmm): Add test case.
Submitted by: Keith Kelleman <keith.kelleman oracle.com>
Modified:
apr/apr-util/branches/1.1.x/CHANGES
apr/apr-util/branches/1.1.x/misc/apr_rmm.c
apr/apr-util/branches/1.1.x/test/testrmm.c
Modified: apr/apr-util/branches/1.1.x/CHANGES
URL: http://svn.apache.org/viewcvs/apr/apr-util/branches/1.1.x/CHANGES?rev=230442&r1=230441&r2=230442&view=diff
==============================================================================
--- apr/apr-util/branches/1.1.x/CHANGES (original)
+++ apr/apr-util/branches/1.1.x/CHANGES Fri Aug 5 04:03:03 2005
@@ -1,5 +1,8 @@
Changes with APR-util 1.1.2
+ *) Fix apr_rmm_realloc() offset calculation bug. [Keith Kelleman
+ <keith.kelleman oracle.com>]
+
*) Fix handling of a premature EOF with the FILE bucket; a new bucket
is not inserted for each attempt to read past EOF. PR 34708.
[Jeff Trawick, Joe Orton]
Modified: apr/apr-util/branches/1.1.x/misc/apr_rmm.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/branches/1.1.x/misc/apr_rmm.c?rev=230442&r1=230441&r2=230442&view=diff
==============================================================================
--- apr/apr-util/branches/1.1.x/misc/apr_rmm.c (original)
+++ apr/apr-util/branches/1.1.x/misc/apr_rmm.c Fri Aug 5 04:03:03 2005
@@ -332,7 +332,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/branches/1.1.x/test/testrmm.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/branches/1.1.x/test/testrmm.c?rev=230442&r1=230441&r2=230442&view=diff
==============================================================================
--- apr/apr-util/branches/1.1.x/test/testrmm.c (original)
+++ apr/apr-util/branches/1.1.x/test/testrmm.c Fri Aug 5 04:03:03 2005
@@ -190,12 +190,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...........................");