You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2014/01/13 14:36:16 UTC
svn commit: r1557709 - in /subversion/trunk/subversion/libsvn_ra_serf:
blame.c get_deleted_rev.c getlocations.c getlocationsegments.c log.c
merge.c stat.c
Author: rhuijben
Date: Mon Jan 13 13:36:16 2014
New Revision: 1557709
URL: http://svn.apache.org/r1557709
Log:
In ra_serf verify if incoming integers are really integers. Before this patch
we would just assume these values were 0 if they weren't valid.
* subversion/libsvn_ra_serf/blame.c
(blame_opened):
* subversion/libsvn_ra_serf/getlocations.c
(getloc_closed):
* subversion/libsvn_ra_serf/getlocationsegments.c
(gls_closed):
* subversion/libsvn_ra_serf/get_deleted_rev.c
(getdrev_closed):
* subversion/libsvn_ra_serf/log.c
(collect_path,
log_closed):
* subversion/libsvn_ra_serf/merge.c
(merge_closed):
* subversion/libsvn_ra_serf/stat.c
(dirent_walker): Check integer value for validity.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/blame.c
subversion/trunk/subversion/libsvn_ra_serf/get_deleted_rev.c
subversion/trunk/subversion/libsvn_ra_serf/getlocations.c
subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c
subversion/trunk/subversion/libsvn_ra_serf/log.c
subversion/trunk/subversion/libsvn_ra_serf/merge.c
subversion/trunk/subversion/libsvn_ra_serf/stat.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/blame.c?rev=1557709&r1=1557708&r2=1557709&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/blame.c Mon Jan 13 13:36:16 2014
@@ -138,17 +138,20 @@ blame_opened(svn_ra_serf__xml_estate_t *
apr_pool_t *state_pool = svn_ra_serf__xml_state_pool(xes);
apr_hash_t *gathered = svn_ra_serf__xml_gather_since(xes, FILE_REV);
const char *path;
- const char *rev;
+ const char *rev_str;
const char *merged_revision;
svn_txdelta_window_handler_t txdelta;
void *txdelta_baton;
+ apr_int64_t rev;
path = svn_hash_gets(gathered, "path");
- rev = svn_hash_gets(gathered, "rev");
+ rev_str = svn_hash_gets(gathered, "rev");
+
+ SVN_ERR(svn_cstring_atoi64(&rev, rev_str));
merged_revision = svn_hash_gets(gathered, "merged-revision");
SVN_ERR(blame_ctx->file_rev(blame_ctx->file_rev_baton,
- path, SVN_STR_TO_REV(rev),
+ path, (svn_revnum_t)rev,
blame_ctx->rev_props,
merged_revision != NULL,
&txdelta, &txdelta_baton,
Modified: subversion/trunk/subversion/libsvn_ra_serf/get_deleted_rev.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/get_deleted_rev.c?rev=1557709&r1=1557708&r2=1557709&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/get_deleted_rev.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/get_deleted_rev.c Mon Jan 13 13:36:16 2014
@@ -75,11 +75,13 @@ getdrev_closed(svn_ra_serf__xml_estate_t
apr_pool_t *scratch_pool)
{
drev_context_t *drev_ctx = baton;
+ apr_int64_t rev;
SVN_ERR_ASSERT(leaving_state == VERSION_NAME);
SVN_ERR_ASSERT(cdata != NULL);
- *drev_ctx->revision_deleted = SVN_STR_TO_REV(cdata->data);
+ SVN_ERR(svn_cstring_atoi64(&rev, cdata->data));
+ *drev_ctx->revision_deleted = (svn_revnum_t)rev;
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/getlocations.c?rev=1557709&r1=1557708&r2=1557709&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/getlocations.c Mon Jan 13 13:36:16 2014
@@ -94,7 +94,12 @@ getloc_closed(svn_ra_serf__xml_estate_t
path = svn_hash_gets(attrs, "path");
if (revstr != NULL && path != NULL)
{
- svn_revnum_t rev = SVN_STR_TO_REV(revstr);
+ apr_int64_t rev_val;
+ svn_revnum_t rev;
+
+ SVN_ERR(svn_cstring_atoi64(&rev_val, revstr));
+ rev = (svn_revnum_t)rev_val;
+
apr_hash_set(loc_ctx->paths,
apr_pmemdup(loc_ctx->pool, &rev, sizeof(rev)), sizeof(rev),
apr_pstrdup(loc_ctx->pool, path));
Modified: subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1557709&r1=1557708&r2=1557709&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c Mon Jan 13 13:36:16 2014
@@ -84,6 +84,8 @@ gls_closed(svn_ra_serf__xml_estate_t *xe
const char *path;
const char *start_str;
const char *end_str;
+ apr_int64_t start_val;
+ apr_int64_t end_val;
svn_location_segment_t segment;
SVN_ERR_ASSERT(leaving_state == SEGMENT);
@@ -95,9 +97,12 @@ gls_closed(svn_ra_serf__xml_estate_t *xe
/* The transition table said these must exist. */
SVN_ERR_ASSERT(start_str && end_str);
+ SVN_ERR(svn_cstring_atoi64(&start_val, start_str));
+ SVN_ERR(svn_cstring_atoi64(&end_val, end_str));
+
segment.path = path; /* may be NULL */
- segment.range_start = SVN_STR_TO_REV(start_str);
- segment.range_end = SVN_STR_TO_REV(end_str);
+ segment.range_start = (svn_revnum_t)start_val;
+ segment.range_end = (svn_revnum_t)end_val;
SVN_ERR(gls_ctx->receiver(&segment, gls_ctx->receiver_baton, scratch_pool));
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/log.c?rev=1557709&r1=1557708&r2=1557709&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/log.c Mon Jan 13 13:36:16 2014
@@ -218,12 +218,14 @@ collect_path(apr_hash_t *paths,
copyfrom_rev = svn_hash_gets(attrs, "copyfrom-rev");
if (copyfrom_path && copyfrom_rev)
{
- svn_revnum_t rev = SVN_STR_TO_REV(copyfrom_rev);
+ apr_int64_t rev;
- if (SVN_IS_VALID_REVNUM(rev))
+ SVN_ERR(svn_cstring_atoi64(&rev, copyfrom_rev));
+
+ if (SVN_IS_VALID_REVNUM((svn_revnum_t)rev))
{
lcp->copyfrom_path = apr_pstrdup(result_pool, copyfrom_path);
- lcp->copyfrom_rev = rev;
+ lcp->copyfrom_rev = (svn_revnum_t)rev;
}
}
@@ -307,7 +309,12 @@ log_closed(svn_ra_serf__xml_estate_t *xe
rev_str = svn_hash_gets(attrs, "revision");
if (rev_str)
- log_entry->revision = SVN_STR_TO_REV(rev_str);
+ {
+ apr_int64_t rev;
+
+ SVN_ERR(svn_cstring_atoi64(&rev, rev_str));
+ log_entry->revision = (svn_revnum_t)rev;
+ }
else
log_entry->revision = SVN_INVALID_REVNUM;
Modified: subversion/trunk/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/merge.c?rev=1557709&r1=1557708&r2=1557709&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/merge.c Mon Jan 13 13:36:16 2014
@@ -171,7 +171,12 @@ merge_closed(svn_ra_serf__xml_estate_t *
rev_str = svn_hash_gets(attrs, "revision");
if (rev_str)
- merge_ctx->commit_info->revision = SVN_STR_TO_REV(rev_str);
+ {
+ apr_int64_t rev;
+
+ SVN_ERR(svn_cstring_atoi64(&rev, rev_str));
+ merge_ctx->commit_info->revision = (svn_revnum_t)rev;
+ }
else
merge_ctx->commit_info->revision = SVN_INVALID_REVNUM;
Modified: subversion/trunk/subversion/libsvn_ra_serf/stat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/stat.c?rev=1557709&r1=1557708&r2=1557709&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/stat.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/stat.c Mon Jan 13 13:36:16 2014
@@ -165,7 +165,10 @@ dirent_walker(void *baton,
{
if (strcmp(name, SVN_DAV__VERSION_NAME) == 0)
{
- dwb->entry->created_rev = SVN_STR_TO_REV(val->data);
+ apr_int64_t rev;
+ SVN_ERR(svn_cstring_atoi64(&rev, val->data));
+
+ dwb->entry->created_rev = (svn_revnum_t)rev;
}
else if (strcmp(name, "creator-displayname") == 0)
{