From effb43a066e70763fa89eb7142b7cb7b428694ad Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 22 Jun 2016 14:10:16 +0900 Subject: Imported Upstream version 1.1.29 Change-Id: I7d894ba27f8f8e886dbcece3bb3df8e69059cae9 Signed-off-by: DongHun Kwak --- libexslt/functions.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libexslt/functions.c') diff --git a/libexslt/functions.c b/libexslt/functions.c index e6e245fd..0795a13d 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -112,6 +112,8 @@ exsltFuncRegisterImportFunc (exsltFuncFunctionData *data, func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name); if (func == NULL) { /* Not yet present - copy it in */ func = exsltFuncNewFunctionData(); + if (func == NULL) + return; memcpy(func, data, sizeof(exsltFuncFunctionData)); if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) { xsltGenericError(xsltGenericErrorContext, @@ -301,6 +303,14 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { func = (exsltFuncFunctionData*) xmlHashLookup2 (data->funcs, ctxt->context->functionURI, ctxt->context->function); + if (func == NULL) { + /* Should never happen */ + xsltGenericError(xsltGenericErrorContext, + "{%s}%s: not found\n", + ctxt->context->functionURI, ctxt->context->function); + ctxt->error = XPATH_UNKNOWN_FUNC_ERROR; + return; + } /* * params handling @@ -494,6 +504,10 @@ exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) { * Create function data */ func = exsltFuncNewFunctionData(); + if (func == NULL) { + xmlFree(name); + return; + } func->content = inst->children; while (IS_XSLT_ELEM(func->content) && IS_XSLT_NAME(func->content, "param")) { -- cgit v1.2.3