720190
# ./pullrev.sh 1667246
720190
720190
https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2015-0248
720190
720190
http://svn.apache.org/viewvc?view=revision&revision=1667246
720190
720190
--- subversion-1.7.14/subversion/mod_dav_svn/reports/get-location-segments.c
720190
+++ subversion-1.7.14/subversion/mod_dav_svn/reports/get-location-segments.c
720190
@@ -181,17 +181,36 @@
720190
                                   "Not all parameters passed.",
720190
                                   SVN_DAV_ERROR_NAMESPACE,
720190
                                   SVN_DAV_ERROR_TAG);
720190
-  if (SVN_IS_VALID_REVNUM(start_rev)
720190
-      && SVN_IS_VALID_REVNUM(end_rev)
720190
-      && (end_rev > start_rev))
720190
+
720190
+  /* No START_REV or PEG_REVISION?  We'll use HEAD. */
720190
+  if (!SVN_IS_VALID_REVNUM(start_rev) || !SVN_IS_VALID_REVNUM(peg_revision))
720190
+    {
720190
+      svn_revnum_t youngest;
720190
+
720190
+      serr = svn_fs_youngest_rev(&youngest, resource->info->repos->fs,
720190
+                                 resource->pool);
720190
+      if (serr != NULL)
720190
+        return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
720190
+                                    "Could not determine youngest revision",
720190
+                                    resource->pool);
720190
+
720190
+      if (!SVN_IS_VALID_REVNUM(start_rev))
720190
+        start_rev = youngest;
720190
+      if (!SVN_IS_VALID_REVNUM(peg_revision))
720190
+        peg_revision = youngest;
720190
+    }
720190
+
720190
+  /* No END_REV?  We'll use 0. */
720190
+  if (!SVN_IS_VALID_REVNUM(end_rev))
720190
+    end_rev = 0;
720190
+
720190
+  if (end_rev > start_rev)
720190
     return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
720190
                                   "End revision must not be younger than "
720190
                                   "start revision",
720190
                                   SVN_DAV_ERROR_NAMESPACE,
720190
                                   SVN_DAV_ERROR_TAG);
720190
-  if (SVN_IS_VALID_REVNUM(peg_revision)
720190
-      && SVN_IS_VALID_REVNUM(start_rev)
720190
-      && (start_rev > peg_revision))
720190
+  if (start_rev > peg_revision)
720190
     return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
720190
                                   "Start revision must not be younger than "
720190
                                   "peg revision",
720190
--- subversion-1.7.14/subversion/svnserve/serve.c
720190
+++ subversion-1.7.14/subversion/svnserve/serve.c
720190
@@ -2266,10 +2266,31 @@
720190
 
720190
   abs_path = svn_fspath__join(b->fs_path->data, relative_path, pool);
720190
 
720190
-  if (SVN_IS_VALID_REVNUM(start_rev)
720190
-      && SVN_IS_VALID_REVNUM(end_rev)
720190
-      && (end_rev > start_rev))
720190
+  SVN_ERR(trivial_auth_request(conn, pool, b));
720190
+  SVN_ERR(log_command(baton, conn, pool, "%s",
720190
+                      svn_log__get_location_segments(abs_path, peg_revision,
720190
+                                                     start_rev, end_rev,
720190
+                                                     pool)));
720190
+
720190
+  /* No START_REV or PEG_REVISION?  We'll use HEAD. */
720190
+  if (!SVN_IS_VALID_REVNUM(start_rev) || !SVN_IS_VALID_REVNUM(peg_revision))
720190
     {
720190
+      svn_revnum_t youngest;
720190
+
720190
+      SVN_CMD_ERR(svn_fs_youngest_rev(&youngest, b->fs, pool));
720190
+
720190
+      if (!SVN_IS_VALID_REVNUM(start_rev))
720190
+        start_rev = youngest;
720190
+      if (!SVN_IS_VALID_REVNUM(peg_revision))
720190
+        peg_revision = youngest;
720190
+    }
720190
+
720190
+  /* No END_REV?  We'll use 0. */
720190
+  if (!SVN_IS_VALID_REVNUM(end_rev))
720190
+    end_rev = 0;
720190
+
720190
+  if (end_rev > start_rev)
720190
+    {
720190
       err = svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
720190
                               "Get-location-segments end revision must not be "
720190
                               "younger than start revision");
720190
@@ -2276,9 +2297,7 @@
720190
       return log_fail_and_flush(err, b, conn, pool);
720190
     }
720190
 
720190
-  if (SVN_IS_VALID_REVNUM(peg_revision)
720190
-      && SVN_IS_VALID_REVNUM(start_rev)
720190
-      && (start_rev > peg_revision))
720190
+  if (start_rev > peg_revision)
720190
     {
720190
       err = svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
720190
                               "Get-location-segments start revision must not "
720190
@@ -2286,12 +2305,6 @@
720190
       return log_fail_and_flush(err, b, conn, pool);
720190
     }
720190
 
720190
-  SVN_ERR(trivial_auth_request(conn, pool, b));
720190
-  SVN_ERR(log_command(baton, conn, pool, "%s",
720190
-                      svn_log__get_location_segments(abs_path, peg_revision,
720190
-                                                     start_rev, end_rev,
720190
-                                                     pool)));
720190
-
720190
   /* All the parameters are fine - let's perform the query against the
720190
    * repository. */
720190