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

[PATCH] fix issue #782

From: Matt Kraai <kraai_at_ftbfs.org>
Date: 2002-11-19 18:00:21 CET

Howdy,
 
A comment in libsvn_fs/reps-strings.c:rep_write_contents mentions that
the length returned by write handlers only matters if there is no
error, and the description of svn_write_fn_t in include/svn_io.h
states that if successful, the length returned should be the same as
the length passed. Ergo, the length should never be changed.

This patch fixes issue #782, and was tested on an i386 machine.

Matt

* subversion/libsvn_delta/svndiff.c
  (write_handler): Do not change *LEN.

Index: subversion/libsvn_delta/svndiff.c
===================================================================
--- subversion/libsvn_delta/svndiff.c (revision 3828)
+++ subversion/libsvn_delta/svndiff.c (working copy)
@@ -391,6 +391,7 @@
   const unsigned char *p, *end;
   apr_off_t val, sview_offset;
   apr_size_t sview_len, tview_len, inslen, newlen, remaining, npos;
+ apr_size_t buflen = *len;
   svn_txdelta_op_t *op;
   int ninst;
 
@@ -398,18 +399,18 @@
   if (db->header_bytes < 4)
     {
       apr_size_t nheader = 4 - db->header_bytes;
- if (nheader > *len)
- nheader = *len;
+ if (nheader > buflen)
+ nheader = buflen;
       if (memcmp (buffer, "SVN\0" + db->header_bytes, nheader) != 0)
         return svn_error_create (SVN_ERR_SVNDIFF_INVALID_HEADER,
                                  0, NULL, "svndiff has invalid header");
- *len -= nheader;
+ buflen -= nheader;
       buffer += nheader;
       db->header_bytes += nheader;
     }
 
   /* Concatenate the old with the new. */
- svn_stringbuf_appendbytes (db->buffer, buffer, *len);
+ svn_stringbuf_appendbytes (db->buffer, buffer, buflen);
 
   /* We have a buffer of svndiff data that might be good for:
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 19 17:57:14 2002

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.