-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directly test bufbuild/protocompile, instead of going through jhump/p…
…rotoreflect/desc/protoparse (#12504) I've recently merged a long-lived "v2" branch to main in the `github.com/jhump/protoreflect` repo. The v2 of that repo does _not_ include a protoparse package, since that has been effectively replaced by `github.com/bufbuild/protocompile`. (Since v1.15 of protoreflect, the protoparse package is just API veneer on top of protocompile.) After I did that merge of v2 to main, the fuzzer for the project began to fail since the packages are no longer present: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=71629 So this updates the fuzzer configuration to directly test the underlying protocompile module. There was also a fuzz tester for the `github.com/jhump/protoreflect/dynamic` package, but it was not actually enabled. (It was disabled in #6369 but neither the PR description nor comment threads describe why this test was problematic 🤷.) Anyhow, that package has also been removed for v2, effectively replaced by `google.golang.org/protobuf/types/dynamicpb`. So this PR deletes it completely from the oss-fuzz repo.
- Loading branch information
Showing
7 changed files
with
51 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package protocompile | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"io" | ||
) | ||
|
||
func FuzzProtoCompile(data []byte) int { | ||
compiler := &Compiler{ | ||
Resolver: &SourceResolver{ | ||
Accessor: func(_ string) (closer io.ReadCloser, e error) { | ||
return io.NopCloser(bytes.NewReader(data)), nil | ||
}, | ||
}, | ||
} | ||
|
||
_, err := compiler.Compile(context.Background(), "test.proto") | ||
if err != nil { | ||
return 0 | ||
} | ||
return 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
homepage: "https://github.com/bufbuild/protocompile" | ||
primary_contact: "jhumphries@buf.build" | ||
auto_ccs: | ||
- "oss-fuzz-reports@buf.build" | ||
language: go | ||
fuzzing_engines: | ||
- libfuzzer | ||
sanitizers: | ||
- address | ||
main_repo: 'https://github.com/bufbuild/protocompile' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.