mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-17 05:05:14 +03:00
44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
From e1e7941022ef6a76217427435d59a7039b4c995e Mon Sep 17 00:00:00 2001
|
|
From: Ivan Romanov <drizt@land.ru>
|
|
Date: Fri, 19 Oct 2018 01:11:45 +0500
|
|
Subject: [PATCH] Fix incorrect double parsing
|
|
|
|
In Qt5 QLocale::toDouble() function can return non null value for
|
|
incorrect input. See QTBUG-71256 for details.
|
|
|
|
Fix #105
|
|
---
|
|
src/json_scanner.cc | 4 ++++
|
|
src/json_scanner.yy | 4 ++++
|
|
2 files changed, 8 insertions(+)
|
|
|
|
diff --git a/src/json_scanner.cc b/src/json_scanner.cc
|
|
index 5995af5..1193071 100644
|
|
--- a/src/json_scanner.cc
|
|
+++ b/src/json_scanner.cc
|
|
@@ -3426,6 +3426,10 @@ YY_RULE_SETUP
|
|
bool ok;
|
|
*m_yylval = QVariant(m_C_locale.toDouble(QLatin1String(yytext),&ok));
|
|
if (!ok) {
|
|
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
+ // See QTBUG-71256
|
|
+ *m_yylval = QVariant(0.);
|
|
+#endif
|
|
qCritical() << "Number is out of range: " << yytext;
|
|
return yy::json_parser::token::INVALID;
|
|
}
|
|
diff --git a/src/json_scanner.yy b/src/json_scanner.yy
|
|
index 3000395..5a2f846 100644
|
|
--- a/src/json_scanner.yy
|
|
+++ b/src/json_scanner.yy
|
|
@@ -107,6 +107,10 @@ null {
|
|
bool ok;
|
|
*m_yylval = QVariant(m_C_locale.toDouble(QLatin1String(yytext),&ok));
|
|
if (!ok) {
|
|
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
+ // See QTBUG-71256
|
|
+ *m_yylval = QVariant(0.);
|
|
+#endif
|
|
qCritical() << "Number is out of range: " << yytext;
|
|
return yy::json_parser::token::INVALID;
|
|
}
|