Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowSpecialNumbers is broken in some cases #42

Open
svuorela opened this issue Jan 9, 2014 · 0 comments
Open

allowSpecialNumbers is broken in some cases #42

svuorela opened this issue Jan 9, 2014 · 0 comments

Comments

@svuorela
Copy link
Contributor

svuorela commented Jan 9, 2014

Parsing a simple [Infinity] works fine, but a more complex { "inf": Infinity } fails

void TestParser::testReadSpecialNumbers() {
    QFETCH(QByteArray, json);
    Parser parser;
    parser.allowSpecialNumbers(true);

    bool ok= false;

    parser.parse(json, &ok);

    QVERIFY(ok);

}

void TestParser::testReadSpecialNumbers_data() {
    QTest::addColumn<QByteArray>("json");

    QTest::newRow("Infinity") << QByteArray("{ \"inf\": Infinity }");
    QTest::newRow("-Infinity") << QByteArray("{ \"inf\": -Infinity }");
    QTest::newRow("NaN") << QByteArray("{ \"nan\": NaN }");
}

This btw worked with a year old QJson.

It is the handling of <ALLOW_SPECIAL_NUMBERS>{ in json_scanner.yy that is somehow broken. Removing the condition in the yy file kind of gives a local fix, but it allows special numbers everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant