[libxslt] Fix UTF-8 check in str:padding
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Fix UTF-8 check in str:padding
- Date: Sat, 27 May 2017 15:17:10 +0000 (UTC)
commit 8418a0b8307f1a5df3c9131498f73b98e482a1d6
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Mon May 22 13:47:12 2017 +0200
Fix UTF-8 check in str:padding
Make sure that all arguments are popped before checking for UTF-8
validity. Improves upon recent commit 1785d11.
libexslt/strings.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/libexslt/strings.c b/libexslt/strings.c
index b967a36..d55ec44 100644
--- a/libexslt/strings.c
+++ b/libexslt/strings.c
@@ -361,6 +361,11 @@ exsltStrPaddingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
str = xmlXPathPopString(ctxt);
str_len = xmlUTF8Strlen(str);
str_size = xmlStrlen(str);
+ }
+
+ floatval = xmlXPathPopNumber(ctxt);
+
+ if (str_len <= 0) {
if (str_len < 0) {
xsltGenericError(xsltGenericErrorContext,
"exsltStrPaddingFunction: invalid UTF-8\n");
@@ -368,16 +373,12 @@ exsltStrPaddingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlFree(str);
return;
}
- }
- if (str_len == 0) {
if (str != NULL) xmlFree(str);
str = xmlStrdup((const xmlChar *) " ");
str_len = 1;
str_size = 1;
}
- floatval = xmlXPathPopNumber(ctxt);
-
if (xmlXPathIsNaN(floatval) || floatval < 0.0) {
number = 0;
} else if (floatval >= 100000.0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]