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

[PATCH] Perl bindings corrupt "{DATE}" revision variable

From: Rainer Müller <raimue_at_codingfarm.de>
Date: Wed, 2 Nov 2016 18:29:04 +0100

Hello,

when passing a revision string in the form of "{DATE}" to the Perl
bindings, the passed string is unexpectedly modified during parsing and
the closing brace will be removed. Here is a Perl script reproducing the
issue with an example:

---8<---

use SVN::Client;

my $ctx = SVN::Client->new();

my $repo = "http://svn.apache.org/repos/asf/subversion/trunk";
my $rev = "{2016-11-02 12:34:56}";

print "Before: $rev\n";

$ctx->info($repo, "HEAD", $rev, sub { print $_[1]->rev . "\n"; }, 0);

print "After: $rev\n";

--->8---

Running this script will give the following output, note the missing
close brace at the end of the third line:

Before: {2016-11-02 12:34:56}
1767638
After: {2016-11-02 12:34:56

I experienced and reproduced this problem with perl 5.20 and 5.24. Due
to different internal memory handling, perl <= 5.18 might not be
affected by this.

This problem originates in the function svn_swig_pl_set_revision in
subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c. I am
attaching a patch that solves this problem by undoing the null byte
insertion, after the modified string was passed to svn_parse_date.

[[
* subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c:
  (svn_swig_pl_set_revision): Undo revision variable modifications
  when using "{DATE}" syntax.
]]

Rainer

Received on 2016-11-02 18:29:48 CET

This is an archived mail posted to the Subversion Dev mailing list.