You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2012/03/21 05:29:43 UTC
svn commit: r1303275 - in /subversion/trunk/subversion/libsvn_ra_serf:
blame.c log.c property.c replay.c
Author: gstein
Date: Wed Mar 21 04:29:43 2012
New Revision: 1303275
URL: http://svn.apache.org/viewvc?rev=1303275&view=rev
Log:
Be careful when using svn_stringbuf__morph_to_string(), as it clears
buf->pool to prevent future modifications. If some cases, we need to
keep the stringbuf around, so we must avoid morphing. We can just
manually copy the data/len pair out. When we keep morphing, we'll set
the buf to NULL to ensure we don't accidentally try to use it.
* property.c:
(end_propfind): set the buf member to NULL for safety
* blame.c:
(create_propval): set the buf member to NULL for safety
* log.c:
(maybe_decode_log_cdata): copy out the members rather than using the
morph function
* replay.c:
(end_replay): set the buf member to NULL for safety
Modified:
subversion/trunk/subversion/libsvn_ra_serf/blame.c
subversion/trunk/subversion/libsvn_ra_serf/log.c
subversion/trunk/subversion/libsvn_ra_serf/property.c
subversion/trunk/subversion/libsvn_ra_serf/replay.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=1303275&r1=1303274&r2=1303275&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/blame.c Wed Mar 21 04:29:43 2012
@@ -141,6 +141,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
return parser->state->private;
}
+
static const svn_string_t *
create_propval(blame_info_t *info)
{
@@ -149,6 +150,9 @@ create_propval(blame_info_t *info)
const svn_string_t *morph;
morph = svn_stringbuf__morph_into_string(info->prop_value);
+#ifdef SVN_DEBUG
+ info->prop_value = NULL; /* morph killed the stringbuf. */
+#endif
return svn_base64_decode_string(morph, info->pool);
}
Modified: subversion/trunk/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/log.c?rev=1303275&r1=1303274&r2=1303275&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/log.c Wed Mar 21 04:29:43 2012
@@ -325,9 +325,12 @@ maybe_decode_log_cdata(const svn_string_
if (info->tmp_encoding)
{
- const svn_string_t *morph;
+ svn_string_t tmp;
- morph = svn_stringbuf__morph_into_string(info->tmp);
+ /* Don't use morph_info_string cuz we need info->tmp to
+ remain usable. */
+ tmp.data = info->tmp->data;
+ tmp.len = info->tmp->len;
/* Check for a known encoding type. This is easy -- there's
only one. */
@@ -338,7 +341,7 @@ maybe_decode_log_cdata(const svn_string_
info->tmp_encoding);
}
- *decoded_cdata = svn_base64_decode_string(morph, info->pool);
+ *decoded_cdata = svn_base64_decode_string(&tmp, info->pool);
}
else
{
Modified: subversion/trunk/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/property.c?rev=1303275&r1=1303274&r2=1303275&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Wed Mar 21 04:29:43 2012
@@ -351,6 +351,9 @@ end_propfind(svn_ra_serf__xml_parser_t *
const svn_string_t *morph;
morph = svn_stringbuf__morph_into_string(info->value);
+#ifdef SVN_DEBUG
+ info->value = NULL; /* morph killed the stringbuf. */
+#endif
val_str = svn_base64_decode_string(morph, ctx->pool);
}
else
Modified: subversion/trunk/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/replay.c?rev=1303275&r1=1303274&r2=1303275&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/replay.c Wed Mar 21 04:29:43 2012
@@ -538,6 +538,9 @@ end_replay(svn_ra_serf__xml_parser_t *pa
const svn_string_t *morph;
morph = svn_stringbuf__morph_into_string(info->prop_value);
+#ifdef SVN_DEBUG
+ info->prop_value = NULL; /* morph killed the stringbuf. */
+#endif
if (strcmp(name.name, "change-file-prop") == 0)
prop_val = svn_base64_decode_string(morph, ctx->file_pool);