diff options
author | Lewis Hyatt <lhyatt@gmail.com> | 2022-11-04 12:50:06 -0400 |
---|---|---|
committer | Lewis Hyatt <lhyatt@gmail.com> | 2022-11-15 10:50:23 -0500 |
commit | ee08aa9ab4100b8774d149bb235b00bddebd4b89 (patch) | |
tree | 52d812ab9bc0dbb23dbe0a29562418a876267b0a /libiberty | |
parent | 15d315553faafeac849522792b465e522c9d665b (diff) | |
download | gcc-ee08aa9ab4100b8774d149bb235b00bddebd4b89.zip gcc-ee08aa9ab4100b8774d149bb235b00bddebd4b89.tar.gz gcc-ee08aa9ab4100b8774d149bb235b00bddebd4b89.tar.bz2 |
diagnostics: Remove null-termination requirement for json::string
json::string currently handles null-terminated data and so can't work with
data that may contain embedded null bytes or that is not null-terminated.
Supporting such data will make json::string more robust in some contexts, such
as SARIF output, which uses it to output user source code that may contain
embedded null bytes.
gcc/ChangeLog:
* json.h (class string): Add M_LEN member to store the length of
the data. Add constructor taking an explicit length.
* json.cc (string::string): Implement the new constructor.
(string::print): Support printing strings that are not
null-terminated. Escape embdedded null bytes on output.
(test_writing_strings): Test the new null-byte-related features of
json::string.
Diffstat (limited to 'libiberty')
0 files changed, 0 insertions, 0 deletions