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 2013/07/02 11:16:55 UTC

svn commit: r1498851 - /subversion/trunk/subversion/libsvn_ra_serf/xml.c

Author: rhuijben
Date: Tue Jul  2 09:16:55 2013
New Revision: 1498851

URL: http://svn.apache.org/r1498851
Log:
In the serf transition based xml parser: provide an explicit error if the root
element isn't matched in the transition table.

Without this most parsers just return success for every invalid element such
as '<html>' when the file contains valid xml.

This requires a better (new) error code which I'll add as a separate commit, to
allow backporting this.

* subversion/libsvn_ra_serf/xml.c
  (svn_ra_serf__xml_cb_start): Expect transitions from the default state to
    succeed, by returning an error when it doesn't.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/xml.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/xml.c?rev=1498851&r1=1498850&r2=1498851&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/xml.c Tue Jul  2 09:16:55 2013
@@ -615,6 +615,14 @@ svn_ra_serf__xml_cb_start(svn_ra_serf__x
     }
   if (scan->ns == NULL)
     {
+      if (current->state == 0)
+        {
+          return svn_error_createf(
+                        SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
+                        _("XML Parsing failed: Unexpected root element '%s'"),
+                        elemname.name);
+        }
+
       xmlctx->waiting = elemname;
       /* ### return?  */
       return SVN_NO_ERROR;



Re: svn commit: r1498851 - /subversion/trunk/subversion/libsvn_ra_serf/xml.c

Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Tue, Jul 2, 2013 at 1:16 PM,  <rh...@apache.org> wrote:
> Author: rhuijben
> Date: Tue Jul  2 09:16:55 2013
> New Revision: 1498851
>
> URL: http://svn.apache.org/r1498851
> Log:
> In the serf transition based xml parser: provide an explicit error if the root
> element isn't matched in the transition table.
>
> Without this most parsers just return success for every invalid element such
> as '<html>' when the file contains valid xml.
>
> This requires a better (new) error code which I'll add as a separate commit, to
> allow backporting this.
>
Great! I agree that new separate error code would be really nice,
since we could handle it in OPTIONS processing to give user suggestion
that he is trying to access non Subversion server.



-- 
Ivan Zhakov
CTO | VisualSVN | http://www.visualsvn.com