Skip to content

fuzz: clear the uber filter's destroy callback on reset - #48794

Merged
RyanTheOptimist merged 1 commit into
envoyproxy:mainfrom
derekargueta:dargueta-deflake-filter-fuzz-reset
Nov 2, 2026
Merged

RyanTheOptimist merged 1 commit into
envoyproxy:mainfrom
derekargueta:dargueta-deflake-filter-fuzz-reset

Conversation

@derekargueta

@derekargueta derekargueta commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Commit Message: fuzz: clear the uber filter's destroy callback on reset

UberFilterFuzzer is a static that gets reused for every input, and reset() ran destroy_filters_ without clearing it. When an input's config adds no filter, such as an empty FilterChainConfig (a valid pass-through), its reset() then called onDestroy() through the previous input's callback, on a filter pointer reset() had already released. That's a null dereference.

This clears the callback in reset() and adds the empty filter_chain input to the corpus, so the corpus test catches a regression whenever a filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 19 times since 09-28, on main postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer printed carry the same empty FilterChainConfig. It looks flaky because that input wasn't in the seed corpus: the job only replays it when its 60s fuzzing phase happens to generate it, and it only crashes when an earlier input in the same process added a filter. It's a fuzz harness bug: the filter_chain filter handles an empty config fine.

envoy_cc_fuzz_test is a dummy main on macOS, so to check this locally I used a throwaway envoy_cc_test that runs buffer1 and then filter_chain_empty_config through one UberFilterFuzzer. Without the fix it segfaulted 3/3, in the addStreamDecoderFilter lambda's onDestroy(). With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass after (macOS arm64, fastbuild); the new corpus file runs, after buffer1, in the corpus replay of the regular test jobs and the Fuzz coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

UberFilterFuzzer is a static reused across every input, and reset() ran
destroy_filters_ without clearing it. An input whose config adds no filter,
such as an empty FilterChainConfig, then had its reset() call onDestroy()
through the previous input's callback on a filter that reset() had already
released, a null dereference. The Fuzz coverage CI job has hit this as a
UBSan SEGV on that input on main and on unrelated PRs since late September.

The empty filter_chain input is added to the corpus, so the corpus test
crashes without the fix whenever any filter-adding input runs before it.

Signed-off-by: Derek Argueta <[email protected]>
@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #48794 was opened by derekargueta.

see: more, trace.

@derekargueta
derekargueta marked this pull request as ready for review November 2, 2026 18:55
@RyanTheOptimist
RyanTheOptimist merged commit ec5e188 into envoyproxy:main Nov 2, 2026
27 checks passed
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 12, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
jwendell pushed a commit that referenced this pull request Nov 12, 2026
Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit that referenced this pull request Nov 17, 2026
Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 18, 2026
…8794)

Commit Message: fuzz: clear the uber filter's destroy callback on reset

`UberFilterFuzzer` is a static that gets reused for every input, and
`reset()` ran `destroy_filters_` without clearing it. When an input's
config adds no filter, such as an empty `FilterChainConfig` (a valid
pass-through), its `reset()` then called `onDestroy()` through the
previous input's callback, on a filter pointer `reset()` had already
released. That's a null dereference.

This clears the callback in `reset()` and adds the empty `filter_chain`
input to the corpus, so the corpus test catches a regression whenever a
filter-adding input runs before it.

Additional Description:
The Fuzz coverage job has hit this as `UndefinedBehaviorSanitizer: SEGV
on unknown address 0x000000000000` 19 times since 09-28, on main
postsubmit and on unrelated PRs. All 14 crash inputs that libFuzzer
printed carry the same empty `FilterChainConfig`. It looks flaky because
that input wasn't in the seed corpus: the job only replays it when its
60s fuzzing phase happens to generate it, and it only crashes when an
earlier input in the same process added a filter. It's a fuzz harness
bug: the `filter_chain` filter handles an empty config fine.

`envoy_cc_fuzz_test` is a dummy main on macOS, so to check this locally
I used a throwaway `envoy_cc_test` that runs `buffer1` and then
`filter_chain_empty_config` through one `UberFilterFuzzer`. Without the
fix it segfaulted 3/3, in the `addStreamDecoderFilter` lambda's
`onDestroy()`. With the fix it passed 3/3.

AI Disclaimer: code change created with AI assistance, fully reviewed by
me prior to opening.

Risk Level: Low (test only)
Testing: throwaway two-input repro above, 3/3 SEGV before and 3/3 pass
after (macOS arm64, fastbuild); the new corpus file runs, after
`buffer1`, in the corpus replay of the regular test jobs and the Fuzz
coverage job
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
(cherry picked from commit ec5e188)
Signed-off-by: Ryan Northey <[email protected]>
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