[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] pre 1.5 api bug, bad array allocation.

From: Martin Hauner <martin.hauner_at_gmx.net>
Date: Tue, 01 Jul 2008 01:22:22 +0200

Hi,

here is a small patch fixing a bad array allocation in 1.5 in the pre
1.5 commit api. Since we are pushing pointers into the array, we should give
it the pointer size and not the struct size. The old code inserts the pointer
elements in a distance of 28 bytes.

I also changed a wrong parameter for log_msg_func2, at least it looks wrong
to me. I'm still running the log_msg_func code so i didn't step through that
path.

Good Night.. :)

[[
Fixed pre 1.5 api compatibility bug.

* subversion/libsvn_client/commit_util.c
   (svn_client__get_log_msg): fixed array allocation with item struct
   size instead of pointer size. Corrected wrong parameter in method
   call.
]]

-- 
Martin
Subcommander 2.0.0 Beta 3, 1.2.4 - http://subcommander.tigris.org
a Win32/Unix/MacOSX subversion GUI client & diff/merge tool.

Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c (revision 31911)
+++ subversion/libsvn_client/commit_util.c (working copy)
@@ -1799,11 +1799,9 @@
       svn_error_t *err;
       apr_pool_t *subpool = svn_pool_create(pool);
       apr_array_header_t *old_commit_items =
- apr_array_make(subpool, commit_items->nelts,
- ctx->log_msg_func2 ? sizeof(svn_client_commit_item2_t) :
- sizeof(svn_client_commit_item_t));
- int i;
+ apr_array_make(subpool, commit_items->nelts, sizeof(void*));
 
+ int i;
       for (i = 0; i < commit_items->nelts; i++)
         {
           svn_client_commit_item3_t *item =
@@ -1848,7 +1846,7 @@
         }
 
       if (ctx->log_msg_func2)
- err = (*ctx->log_msg_func2)(log_msg, tmp_file, commit_items,
+ err = (*ctx->log_msg_func2)(log_msg, tmp_file, old_commit_items,
                                     ctx->log_msg_baton2, pool);
       else
         err = (*ctx->log_msg_func)(log_msg, tmp_file, old_commit_items,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-07-01 01:22:49 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.