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

@Ekam219: Fix Logging and Error Handling for get_benchmark_final_target_code #919

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

Conversation

DonggeLiu
Copy link
Collaborator

@DonggeLiu DonggeLiu commented Mar 22, 2025

From @Ekam219's #910.

@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ej -ag

@DonggeLiu
Copy link
Collaborator Author

Sibling PR: #918

@DonggeLiu
Copy link
Collaborator Author

There is something wrong with the report (no crash, no fuzz target source code) but I reckon it's from another PR.
Let's hold this for a few days and run another experiment once that bug is fixed.

DonggeLiu and others added 3 commits March 24, 2025 11:39
)

## Description
This PR addresses the issue of missing source code by adding enhanced
logging and improving error handling in the
`get_benchmark_final_target_code()` method. Previously, silent failures
could occur, making it difficult to diagnose the root cause of missing
source code.

## Changes
- **Enhanced Logging**: Logs are added to track when the `sample_id` is
invalid or the source code is missing.
- **Error Handling**: Ensures that malformed or empty `sample_id` values
are handled gracefully and logged appropriately.
- **Return Null for Missing Source Code**: In case of an error, the
function explicitly returns `None` rather than an empty string for
clarity in JSON outputs.
#908
It may also refer to #625
## Benefits
- Improved **debuggability** by making it easier to identify the reasons
behind missing source code.
- Increased **robustness** by preventing silent failures and ensuring
more informative logs and error handling.
@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ej -ag

@DonggeLiu
Copy link
Collaborator Author

Hi @Ekam219
It appears there is more to fix:

    {
        "benchmark": "int LibRaw::crxDecodePlane(void *, uint32_t)",
        "sample": "08",
        "status": "Done",
        "compiles": "True",
        "crashes": "True",
        "crash_reason": "NO_SEMANTIC_ERR",
        "bug": "True",
        "triage": "",
        "coverage": "4.34",
        "coverage_diff": "0.00014912908613696016",
        "coverage_report": "#",
        "stacktrace": "/stacktrace",
        "target_binary": "/target_binary",
        "reproducer": "/artifacts",
        "run_log": "run.log",
        "source_code": null,
        "model": "vertex_ai_gemini-1-5-chat"
    },

@Ekam219
Copy link

Ekam219 commented Mar 31, 2025

Sure , looking into this

@@ -284,7 +310,7 @@ def get_final_target_code(self, benchmark: str, sample: str) -> str:
targets_dir = os.path.join(self._results_dir, benchmark, 'fixed_targets')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon this could be the cause.
Previously OSS-Fuzz-Gen saves the final fuzz target in to this dir.
Now it is placed into:

  • results/output-libraw-_zn6libraw14crxdecodeplaneepvj/fuzz_targets/{sample_id}.fuzz_target
  • results/output-libraw-_zn6libraw14crxdecodeplaneepvj/fuzz_targets/{sample_id}.build_script

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