diff --git a/src/core/lib/json/json_writer.cc b/src/core/lib/json/json_writer.cc index 462a0d88b72..ef07c5e3925 100644 --- a/src/core/lib/json/json_writer.cc +++ b/src/core/lib/json/json_writer.cc @@ -145,9 +145,7 @@ void JsonWriter::EscapeString(const std::string& string) { OutputChar('"'); for (size_t idx = 0; idx < string.size(); ++idx) { uint8_t c = static_cast(string[idx]); - if (c == 0) { - break; - } else if (c >= 32 && c <= 126) { + if (c >= 32 && c <= 126) { if (c == '\\' || c == '"') OutputChar('\\'); OutputChar(static_cast(c)); } else if (c < 32 || c == 127) { diff --git a/test/core/json/corpus/testcase-6037245441474560 b/test/core/json/corpus/testcase-6037245441474560 new file mode 100644 index 00000000000..86e84f45682 --- /dev/null +++ b/test/core/json/corpus/testcase-6037245441474560 @@ -0,0 +1 @@ +"\u0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" \ No newline at end of file diff --git a/test/core/json/corpus/testcase-6329722588758016 b/test/core/json/corpus/testcase-6329722588758016 new file mode 100644 index 00000000000..ed6780dcbd6 --- /dev/null +++ b/test/core/json/corpus/testcase-6329722588758016 @@ -0,0 +1 @@ +"\u0000" \ No newline at end of file