Skip to content

Can't parse SARIF files generated with gcc and -fdiagnostics-color=always #114

Description

@wouterklouwen-youview

When using GCC/G++ to compile, passing -fdiagnostics-color=always as well as -fdiagnostics-add-output=sarif means that GCC 16.1.1 produces ANSI escape characters in it's message output, e.g.:

"message": {"text": "by argument 2 of type ‘^[[01m^[[Kconst uint8_t*^[[m^[[K’ {{aka ‘^[[01m^[[Kconst unsigned char*^[[m^[[K’}} to ‘a::b::c::D::Dconst uint8_t*)’ declared here"},

While technically speaking this does not comply with JSON standards/encoding, adding strict=False to the json.load() call in load_sarif_file() makes it possible to ingest such a file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions