diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-03-20 16:03:10 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-03-20 16:03:10 +0100 |
commit | d8dda889b361f85fd94c6a2feba61e2309a17515 (patch) | |
tree | b7defce5aa707f42ef46f6471e14eba86a73d869 | |
parent | 4d630a05c30c8d178dd1de0d1cf309e9c4e5bcca (diff) | |
download | libxslt-d8dda889b361f85fd94c6a2feba61e2309a17515.tar.gz |
malloc-fail: Fix null deref when formatting numbers
Add an error check to make sure string conversion worked.
Found by OSS-Fuzz, see #84.
-rw-r--r-- | libxslt/functions.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libxslt/functions.c b/libxslt/functions.c index f5e5d748..a1484a07 100644 --- a/libxslt/functions.c +++ b/libxslt/functions.c @@ -656,7 +656,8 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) return; } - if ((formatValues != NULL) && (formatObj != NULL) && (numberObj != NULL)) { + if ((ctxt->error == 0) && + (formatValues != NULL) && (formatObj != NULL) && (numberObj != NULL)) { if (xsltFormatNumberConversion(formatValues, formatObj->stringval, numberObj->floatval, |