Commit 5164c9b3b67cb039ce74d3a541a1cac6978bc90b

  • avatar
  • Flavio Castelli <fcastelli @nov…ll.com>
  • Wed Sep 08 11:19:04 CEST 2010
fixed possible overflow during number parsing
  
278278 }
279279 }
280280 else if (isdigit(ch) != 0 && m_quotmarkClosed) {
281 qint64 number = atoll(&ch);
281 quint64 number = atoll(&ch);
282282 char nextCh;
283283 qint64 ret = m_io->peek(&nextCh, 1);
284284 while (ret == 1 && isdigit(nextCh)) {
285285 m_io->read(1); //consume
286286 yylloc->columns(1);
287 number = number *10 + atoll(&nextCh);
287 number = number * 10 + atoll(&nextCh);
288288 ret = m_io->peek(&nextCh, 1);
289289 }
290290
  
280280 QTest::newRow("simple ulonglong") << input << output << QVariant::ULongLong;
281281
282282 // big number
283 input = QByteArray("128708157440");
283 input = QByteArray("12345678901234567890");
284284 output = QVariant(QVariant::ULongLong);
285 output.setValue(128708157440ull);
285 output.setValue(12345678901234567890ull);
286286
287287 QTest::newRow("big number") << input << output << QVariant::ULongLong;
288288