Skip to content

YAMLParser throws unexpected NullPointerException in certain number parsing cases #445

Closed
@arthurscchan

Description

@arthurscchan

In YAMLParse::getNumberValueDeferred() / YAMLParse::_parseNumericValue() / YAMLParse::_parseIntValuev() methods, the lenght() method of the String object _cleanedTextValue is called. This could cause an unexpected NullPointerException when the previous steps make _cleanedTextValue become null with an invalid input value. To fix it, it is suggested to add a conditional check and report an error when _cleanedTextValue is null.

if (_cleanedTextValue.length() <= 18) {
    return getNumberValue();
}

We found this issue by OSS-Fuzz and it is reported in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64662.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions