Commit 6197b21b authored by Andrea Iacovitti's avatar Andrea Iacovitti
Browse files

Support up to INT_MAX (2^31-1) for the absolute value of css <number> data type.

When converting parsed number from string to double do not use a flot variable to store
the result as it does not have the necessary precision to represent exactly all the values
in the 32-bit integer range. Use a double instead.

BUG: 335346
FIXED-IN: 4.13.2
parent e67c7665
......@@ -2709,6 +2709,7 @@ static inline int yyerror( const char *str ) {
return 1;
}
static const qreal dIntMax = INT_MAX;
#define END 0
#include "parser.h"
......@@ -2793,7 +2794,7 @@ int DOM::CSSParser::lex( void *_yylval )
length--;
case FLOAT:
case INTEGER:
yylval->val = QString( (QChar *)t, length ).toDouble();
yylval->val = qMin(QString((QChar *)t, length).toDouble(), dIntMax);
//qDebug("value = %s, converted=%.2f", QString( (QChar *)t, length ).toLatin1().constData(), yylval->val );
break;
......
......@@ -289,7 +289,7 @@ typedef union YYSTYPE
CSSMediaRuleImpl *mediaRule;
CSSRuleListImpl *ruleList;
ParseString string;
float val;
double val;
int prop_id;
unsigned int attribute;
unsigned int element;
......
......@@ -109,7 +109,7 @@ typedef union YYSTYPE
CSSMediaRuleImpl *mediaRule;
CSSRuleListImpl *ruleList;
ParseString string;
float val;
double val;
int prop_id;
unsigned int attribute;
unsigned int element;
......
......@@ -121,7 +121,7 @@ int DOM::getValueID(const char *tagStr, int len)
CSSMediaRuleImpl *mediaRule;
CSSRuleListImpl *ruleList;
ParseString string;
float val;
double val;
int prop_id;
unsigned int attribute;
unsigned int element;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment