You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jf...@apache.org on 2004/05/21 09:13:44 UTC
cvs commit: apr-util/xml apr_xml.c
jfclere 2004/05/21 00:13:44
Modified: xml apr_xml.c
Log:
Print "No parser." in errbuf when parser is NULL.
Revision Changes Path
1.29 +9 -3 apr-util/xml/apr_xml.c
Index: apr_xml.c
===================================================================
RCS file: /home/cvs/apr-util/xml/apr_xml.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- apr_xml.c 13 Feb 2004 09:55:27 -0000 1.28
+++ apr_xml.c 21 May 2004 07:13:44 -0000 1.29
@@ -414,15 +414,21 @@
char *errbuf,
apr_size_t errbufsize)
{
- int error = parser->error;
+ int error = 0;
const char *msg;
/* clear our record of an error */
- parser->error = 0;
+ if (parser != NULL) {
+ error = parser->error;
+ parser->error = 0;
+ }
switch (error) {
case 0:
- msg = "No error.";
+ if (parser != NULL)
+ msg = "No error.";
+ else
+ msg = "No parser.";
break;
case APR_XML_NS_ERROR_UNKNOWN_PREFIX:
Re: cvs commit: apr-util/xml apr_xml.c
Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Joe Orton wrote:
> On Fri, May 21, 2004 at 02:48:21PM +0200, jean-frederic clere wrote:
>
>>Joe Orton wrote:
>>
>>>On Fri, May 21, 2004 at 07:13:44AM -0000, jfclere@apache.org wrote:
>>>
>>>
>>>>jfclere 2004/05/21 00:13:44
>>>>
>>>>Modified: xml apr_xml.c
>>>>Log:
>>>>Print "No parser." in errbuf when parser is NULL.
>>>
>>>
>>>Why? Passing a NULL parser argument to apr_xml_parser_geterror sounds
>>>like a good time to SIGSEGV.
>>
>>Before commiting it I have looked in apache-2.0/server/util_xml.c: there
>>is a apr_xml_parser_geterror()...
>
>
> It's not valid (as far as I can see, needn't be valid) to pass a NULL
> parser argument to apr_xml_parser_geterror(). What bug are you seeing
> which prompted this change?
Sorry... If apr_xml_parser_create() returns NULL.
The bug only occurs in apr-util/test/testxml I will rollback the correction (in
xml/apr_xml.c) and fix test/testxml.c.
That is the xml file that cores testxml:
+++
<?xml version='1.0' encoding='utf-8'
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>
+++
>
> joe
>
>
Re: cvs commit: apr-util/xml apr_xml.c
Posted by Joe Orton <jo...@manyfish.co.uk>.
On Fri, May 21, 2004 at 02:48:21PM +0200, jean-frederic clere wrote:
> Joe Orton wrote:
> >On Fri, May 21, 2004 at 07:13:44AM -0000, jfclere@apache.org wrote:
> >
> >>jfclere 2004/05/21 00:13:44
> >>
> >> Modified: xml apr_xml.c
> >> Log:
> >> Print "No parser." in errbuf when parser is NULL.
> >
> >
> >Why? Passing a NULL parser argument to apr_xml_parser_geterror sounds
> >like a good time to SIGSEGV.
>
> Before commiting it I have looked in apache-2.0/server/util_xml.c: there
> is a apr_xml_parser_geterror()...
It's not valid (as far as I can see, needn't be valid) to pass a NULL
parser argument to apr_xml_parser_geterror(). What bug are you seeing
which prompted this change?
joe
Re: cvs commit: apr-util/xml apr_xml.c
Posted by Joe Orton <jo...@manyfish.co.uk>.
On Fri, May 21, 2004 at 07:13:44AM -0000, jfclere@apache.org wrote:
> jfclere 2004/05/21 00:13:44
>
> Modified: xml apr_xml.c
> Log:
> Print "No parser." in errbuf when parser is NULL.
Why? Passing a NULL parser argument to apr_xml_parser_geterror sounds
like a good time to SIGSEGV. Have you read the code style guide?
> --- apr_xml.c 13 Feb 2004 09:55:27 -0000 1.28
> +++ apr_xml.c 21 May 2004 07:13:44 -0000 1.29
> @@ -414,15 +414,21 @@
> char *errbuf,
> apr_size_t errbufsize)
> {
> - int error = parser->error;
> + int error = 0;
> const char *msg;
>
> /* clear our record of an error */
> - parser->error = 0;
> + if (parser != NULL) {
> + error = parser->error;
> + parser->error = 0;
> + }
>
> switch (error) {
> case 0:
> - msg = "No error.";
> + if (parser != NULL)
> + msg = "No error.";
> + else
> + msg = "No parser.";
> break;
>
> case APR_XML_NS_ERROR_UNKNOWN_PREFIX:
>
>
>