From 7cb3fa9d51a0a57d1e538854e4be84db82b75098 Mon Sep 17 00:00:00 2001 From: "Kasimier T. Buchcik" Date: Tue, 6 Jun 2006 15:27:46 +0000 Subject: [PATCH] Fixed self-invented a segfault in xmlXPathCtxtCompile(), when the * xpath.c: Fixed self-invented a segfault in xmlXPathCtxtCompile(), when the expression was not valid and @comp was NULL and I tried to do the d-o-s rewrite. --- ChangeLog | 6 ++++++ xpath.c | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a3a8f12..9a392911 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Jun 6 17:25:23 CEST 2006 Kasimier Buchcik + + * xpath.c: Fixed self-invented a segfault in xmlXPathCtxtCompile(), + when the expression was not valid and @comp was NULL and I + tried to do the d-o-s rewrite. + Tue Jun 6 15:19:57 CEST 2006 Daniel Veillard * configure.ini NEWS doc//* libxml.spec.in : preparing release of 2.6.25 diff --git a/xpath.c b/xpath.c index ce62a564..c6c22744 100644 --- a/xpath.c +++ b/xpath.c @@ -14137,12 +14137,12 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { #ifdef DEBUG_EVAL_COUNTS comp->string = xmlStrdup(str); comp->nb = 0; -#endif - } - if ((comp->nbStep > 2) && - (xmlXPathCanRewriteDosExpression(comp->expr) == 1)) - { - xmlXPathRewriteDOSExpression(comp, &comp->steps[comp->last]); +#endif + if ((comp->nbStep > 2) && + (xmlXPathCanRewriteDosExpression(comp->expr) == 1)) + { + xmlXPathRewriteDOSExpression(comp, &comp->steps[comp->last]); + } } return(comp); } @@ -14263,7 +14263,8 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { #endif { xmlXPathCompileExpr(ctxt, 1); - if ((ctxt->comp->nbStep > 2) && + if ((ctxt->comp != NULL) && + (ctxt->comp->nbStep > 2) && (xmlXPathCanRewriteDosExpression(ctxt->comp->expr) == 1)) { xmlXPathRewriteDOSExpression(ctxt->comp,