You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/10/17 18:54:28 UTC
svn commit: r1632635 - in /subversion/trunk/subversion: include/svn_delta.h
libsvn_delta/text_delta.c
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