Author: svn-role
Date: Sat Nov 22 04:00:41 2014
New Revision: 1641029

URL: http://svn.apache.org/r1641029
Log:
Merge the 1.7.x-r1462041 branch:

 * r1462041
   Fix issue issue 4339, diff suffix scanning invalid read at last chunk
   boundary.
   Justification:
     Without this patch we access memory that isn't part of the diff, which
     in some cases causes a segfault.
   Notes:
     This branch only merges the actual fix. Trunk and 1.8.x have a test
     for this case.
   Branch:
     ^/subversion/branches/1.7.x-r1462041
   Votes:
     +1: rhuijben, stsp, philip

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/libsvn_diff/diff_file.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1462041
  Merged /subversion/branches/1.7.x-r1462041:r1617243-1641028

Modified: subversion/branches/1.7.x/STATUS
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1641029&r1=1641028&r2=1641029&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Sat Nov 22 04:00:41 2014
@@ -152,17 +152,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1462041
-   Fix issue issue 4339, diff suffix scanning invalid read at last chunk
-   boundary.
-   Justification:
-     Without this patch we access memory that isn't part of the diff, which
-     in some cases causes a segfault.
-   Notes:
-     This branch only merges the actual fix. Trunk and 1.8.x have a test
-     for this case.
-   Branch:
-     ^/subversion/branches/1.7.x-r1462041
-   Votes:
-     +1: rhuijben, stsp, philip

Modified: subversion/branches/1.7.x/subversion/libsvn_diff/diff_file.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_diff/diff_file.c?rev=1641029&r1=1641028&r2=1641029&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_diff/diff_file.c Sat Nov 22 
04:00:41 2014
@@ -556,6 +556,13 @@ find_identical_suffix(apr_off_t *suffix_
       file_for_suffix[i].chunk =
         (int) offset_to_chunk(file_for_suffix[i].size); /* last chunk */
       length[i] = offset_in_chunk(file_for_suffix[i].size);
+      if (length[i] == 0)
+        {
+          /* last chunk is an empty chunk -> start at next-to-last chunk */
+          file_for_suffix[i].chunk = file_for_suffix[i].chunk - 1;
+          length[i] = CHUNK_SIZE;
+        }
+
       if (file_for_suffix[i].chunk == file[i].chunk)
         {
           /* Prefix ended in last chunk, so we can reuse the prefix buffer */


Reply via email to