diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc index ede4710cc6..cdf63cba9e 100644 --- a/conformance/binary_json_conformance_suite.cc +++ b/conformance/binary_json_conformance_suite.cc @@ -2303,7 +2303,8 @@ void BinaryAndJsonConformanceSuiteImpl< R"({"optionalInt64": "-9223372036854775809"})"); ExpectParseFailureForJson("Uint64FieldTooLarge", REQUIRED, R"({"optionalUint64": "18446744073709551616"})"); - // Parser reject non-integer numeric values as well. + + // Parser reject non-integer numeric values. ExpectParseFailureForJson("Int32FieldNotInteger", REQUIRED, R"({"optionalInt32": 0.5})"); ExpectParseFailureForJson("Uint32FieldNotInteger", REQUIRED, @@ -2313,6 +2314,16 @@ void BinaryAndJsonConformanceSuiteImpl< ExpectParseFailureForJson("Uint64FieldNotInteger", REQUIRED, R"({"optionalUint64": "0.5"})"); + // Parser reject empty string values. + ExpectParseFailureForJson("Int32FieldEmptyString", REQUIRED, + R"({"optionalInt32": ""})"); + ExpectParseFailureForJson("Uint32FieldEmptyString", REQUIRED, + R"({"optionalUint32": ""})"); + ExpectParseFailureForJson("Int64FieldEmptyString", REQUIRED, + R"({"optionalInt64": ""})"); + ExpectParseFailureForJson("Uint64FieldEmptyString", REQUIRED, + R"({"optionalUint64": ""})"); + // Integers but represented as float values are accepted. RunValidJsonTest("Int32FieldFloatTrailingZero", REQUIRED, R"({"optionalInt32": 100000.000})", @@ -2436,12 +2447,17 @@ void BinaryAndJsonConformanceSuiteImpl< R"({"optionalFloat": Infinity})"); ExpectParseFailureForJson("FloatFieldNegativeInfinityNotQuoted", RECOMMENDED, R"({"optionalFloat": -Infinity})"); + // Parsers should reject out-of-bound values. ExpectParseFailureForJson("FloatFieldTooSmall", REQUIRED, R"({"optionalFloat": -3.502823e+38})"); ExpectParseFailureForJson("FloatFieldTooLarge", REQUIRED, R"({"optionalFloat": 3.502823e+38})"); + // Parsers should reject empty string values. + ExpectParseFailureForJson("FloatFieldEmptyString", REQUIRED, + R"({"optionalFloat": ""})"); + // Double fields. RunValidJsonTest("DoubleFieldMinPositiveValue", REQUIRED, R"({"optionalDouble": 2.22507e-308})", @@ -2494,6 +2510,10 @@ void BinaryAndJsonConformanceSuiteImpl< ExpectParseFailureForJson("DoubleFieldTooLarge", REQUIRED, R"({"optionalDouble": +1.89769e+308})"); + // Parsers should reject empty string values. + ExpectParseFailureForJson("DoubleFieldEmptyString", REQUIRED, + R"({"optionalDouble": ""})"); + // Enum fields. RunValidJsonTest("EnumField", REQUIRED, R"({"optionalNestedEnum": "FOO"})", "optional_nested_enum: FOO"); diff --git a/conformance/failure_list_jruby_ffi.txt b/conformance/failure_list_jruby_ffi.txt index e69de29bb2..81ebd2e020 100644 --- a/conformance/failure_list_jruby_ffi.txt +++ b/conformance/failure_list_jruby_ffi.txt @@ -0,0 +1,24 @@ +Required.Editions_Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. diff --git a/conformance/failure_list_php_c.txt b/conformance/failure_list_php_c.txt index df662c320a..e9853d8d2f 100644 --- a/conformance/failure_list_php_c.txt +++ b/conformance/failure_list_php_c.txt @@ -1,4 +1,28 @@ Recommended.Proto2.JsonInput.FieldNameExtension.Validator +Required.Editions_Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. Required.Proto2.JsonInput.BoolFieldFalse.JsonOutput Required.Proto2.JsonInput.BoolFieldFalse.ProtobufOutput Required.Proto2.JsonInput.EnumField.JsonOutput diff --git a/conformance/failure_list_ruby.txt b/conformance/failure_list_ruby.txt index e69de29bb2..81ebd2e020 100644 --- a/conformance/failure_list_ruby.txt +++ b/conformance/failure_list_ruby.txt @@ -0,0 +1,24 @@ +Required.Editions_Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. diff --git a/upb/conformance/conformance_upb_failures.txt b/upb/conformance/conformance_upb_failures.txt index e69de29bb2..81ebd2e020 100644 --- a/upb/conformance/conformance_upb_failures.txt +++ b/upb/conformance/conformance_upb_failures.txt @@ -0,0 +1,24 @@ +Required.Editions_Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Editions_Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto2.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.DoubleFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.FloatFieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Int64FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint32FieldEmptyString # Should have failed to parse, but didn't. +Required.Proto3.JsonInput.Uint64FieldEmptyString # Should have failed to parse, but didn't.