Skip to content

Conversation

@oetr
Copy link
Contributor

@oetr oetr commented Nov 5, 2025

Using ClassWriter without ClassReader in asm, seems to produce
corrupted bytecode for nested records and records with annotated fields.

Prior to this fix, a segfault was triggered for nested records that
use Jazzer annotations when Jazzer was trying to access data on record
components, when trying to create a record mutator.

In addition, for non-nested records with annotated fields as for example:
record Address(byte @WithLength(max=10) [] data) {}
no suitable mutator could be found.

@oetr oetr force-pushed the CIF-1871-bugfix-nested-record-annotation-instrumentation branch from 231fcbc to f31e023 Compare November 7, 2025 11:28
Using ClassWriter without ClassReader in asm, seems to produce
corrupted bytecode for nested records and records with annotated fields.

Prior to this fix, a segfault was triggered for nested records that
use Jazzer annotations when Jazzer was trying to access data on record
components, when trying to create a record mutator.

In addition, for non-nested records with annotated fields as for example:
record Address(byte @WithLength(max=10) [] data) {}
no suitable mutator could be found.
@oetr oetr force-pushed the CIF-1871-bugfix-nested-record-annotation-instrumentation branch from f31e023 to 4d18863 Compare November 7, 2025 11:29
@oetr oetr marked this pull request as ready for review November 7, 2025 11:29
Copilot AI review requested due to automatic review settings November 7, 2025 11:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the TraceDataFlowInstrumentor that could cause segfaults when instrumenting classes with nested records, and adds a regression test to prevent this issue from recurring.

  • Fixed ClassWriter initialization to pass ClassReader for proper constant pool reuse
  • Added regression test for fuzzing classes with nested record types
  • Configured test with Java 17 support (required for records)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/main/java/com/code_intelligence/jazzer/instrumentor/TraceDataFlowInstrumentor.kt Fixed ClassWriter initialization to pass ClassReader for improved compatibility with complex class structures like nested records
tests/src/test/java/com/example/NestedRecordFuzzer.java Added regression test to verify correct instrumentation of fuzz test classes containing nested records
tests/BUILD.bazel Added build configuration for NestedRecordFuzzer test with Java 17 support and appropriate dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@simonresch simonresch left a comment

Choose a reason for hiding this comment

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

Very good find!
As discussed: Let's merge this and continue to reduce the ASM and/or JVM bug independently.

@oetr oetr enabled auto-merge (rebase) November 11, 2025 08:03
@oetr oetr merged commit 94ea994 into main Nov 11, 2025
15 checks passed
@oetr oetr deleted the CIF-1871-bugfix-nested-record-annotation-instrumentation branch November 11, 2025 08:23
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.

4 participants