subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1632635 - in /subversion/trunk/subversion: include/svn_delta.h libsvn_delta/text_delta.c
Date Fri, 17 Oct 2014 16:54:28 GMT
Author: stefan2
Date: Fri Oct 17 16:54:27 2014
New Revision: 1632635

URL: http://svn.apache.org/r1632635
Log:
Fix an instance where we call memcpy of 0 bytes with a NULL target.

* subversion/include/svn_delta.h
  (svn_txdelta_apply_instructions): Update docstring.

* subversion/libsvn_delta/text_delta.c
  (svn_txdelta_apply_instructions): Don't touch any of the buffers
                                    if the target has zero size.

Found by: philipm

Modified:
    subversion/trunk/subversion/include/svn_delta.h
    subversion/trunk/subversion/libsvn_delta/text_delta.c

Modified: subversion/trunk/subversion/include/svn_delta.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_delta.h?rev=1632635&r1=1632634&r2=1632635&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_delta.h (original)
+++ subversion/trunk/subversion/include/svn_delta.h Fri Oct 17 16:54:27 2014
@@ -249,6 +249,7 @@ svn_txdelta_compose_windows(const svn_tx
  *
  * @since New in 1.4
  *
+ * @since Since 1.9, @a tbuf may be NULL if @a *tlen is 0.
  */
 void
 svn_txdelta_apply_instructions(svn_txdelta_window_t *window,

Modified: subversion/trunk/subversion/libsvn_delta/text_delta.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/text_delta.c?rev=1632635&r1=1632634&r2=1632635&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/text_delta.c (original)
+++ subversion/trunk/subversion/libsvn_delta/text_delta.c Fri Oct 17 16:54:27 2014
@@ -656,6 +656,11 @@ svn_txdelta_apply_instructions(svn_txdel
   const svn_txdelta_op_t *op;
   apr_size_t tpos = 0;
 
+  /* Nothing to do for empty buffers.
+   * This check allows for NULL TBUF in that case. */
+  if (*tlen == 0)
+    return;
+
   for (op = window->ops; op < window->ops + window->num_ops; op++)
     {
       const apr_size_t buf_len = (op->length < *tlen - tpos



Mime
View raw message