Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Kartikayy007: Add proper JSON escaping in crash report templates #918

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DonggeLiu
Copy link
Collaborator

No description provided.

@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ks -ag

@DonggeLiu
Copy link
Collaborator Author

Sibling PR: #919

DonggeLiu and others added 3 commits March 24, 2025 11:39
# Fix JSON format errors in crash reports

## Description
This PR fixes JSON format errors in crash reports due to improper
escaping or were missing quotes entirely, causing parsing errors
referenced in issue.

fixes: #903 

## Changes
* Added proper quotes around template expressions
* Added proper escaping for double quotes with `\"`
* Added proper formatting for newlines as `\n`

## Example
Before:
```json
{
  "samples": [
    {
      "coverage_report": "#",
      "stacktrace": "/stacktrace",
      "target_binary": "/target_binary",
      "reproducer": "/artifacts",
      "run_log": "run.log",
      "source_code": ,
      "model": "claude-3-opus-20240229"
    }
  ]
}
```

After:
```json
{
  "samples": [
    {
      "coverage_report": "#",
      "stacktrace": "SIGSEGV\ncrash at 0x004a3f21\n#0 0x004a3f21 in function()",
      "target_binary": "/target_binary",
      "reproducer": "/artifacts",
      "run_log": "run.log",
      "source_code": "#include <stdint.h>\n#include <stdlib.h>\nint LLVMFuzzerTestOneInput() {...}",
      "model": "claude-3-opus-20240229"
    }
  ]
}
```
@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ks -ag

@DonggeLiu
Copy link
Collaborator Author

Hi @Kartikayy007
It appears the fuzz target is still not parsed:

    {
        "benchmark": "char * af_gb_alloc_data(size_t)",
        "sample": "04",
        "status": "Done",
        "compiles": "True",
        "crashes": "True",
        "crash_reason": "NO_SEMANTIC_ERR",
        "bug": "True",
        "triage": "",
        "coverage": "12.31",
        "coverage_diff": "0.10619469026548672",
        "coverage_report": "#",
        "stacktrace": "/stacktrace",
        "target_binary": "/target_binary",
        "reproducer": "/artifacts",
        "run_log": "run.log",
        "source_code": "",
        "model": "vertex_ai_gemini-1-5-chat"
    },

    {
        "benchmark": "char * af_gb_alloc_data(size_t)",
        "sample": "05",
        "status": "Done",
        "compiles": "True",
        "crashes": "True",
        "crash_reason": "NO_SEMANTIC_ERR",
        "bug": "True",
        "triage": "",
        "coverage": "5.26",
        "coverage_diff": "0.10619469026548672",
        "coverage_report": "#",
        "stacktrace": "/stacktrace",
        "target_binary": "/target_binary",
        "reproducer": "/artifacts",
        "run_log": "run.log",
        "source_code": "",
        "model": "vertex_ai_gemini-1-5-chat"
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants