Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@skypher
Copy link

@skypher skypher commented Dec 18, 2025

Summary

Adds 16 fuzz tests covering various parsing functions.

Fuzz Tests

Package Fuzzer Target
fs/ggml FuzzGGUFDecode GGUF binary format parser
fs/ggml FuzzParseFileType File type string parser
fs/ggml FuzzParseTensorType Tensor type string parser
fs/ggml FuzzDetectContentType Content type detection
server/internal/cache/blob FuzzParseDigest Digest string parsing
server FuzzParseModelPath Model path parsing
parser FuzzParseFile Modelfile parsing
template FuzzParse Template parsing
api FuzzDurationUnmarshal Duration JSON parsing
api FuzzMessageUnmarshal Message JSON parsing
api FuzzPropertyTypeUnmarshal PropertyType JSON parsing
api FuzzThinkValueUnmarshal ThinkValue JSON parsing
openai FuzzResponsesInputMessage OpenAI responses message parsing
openai FuzzResponsesInput OpenAI responses input parsing
convert FuzzSafetensorsMetadata Safetensors metadata parsing

How to Run

# Example: run GGUF fuzzer for 60 seconds
go test -fuzz=FuzzGGUFDecode -fuzztime=60s ./fs/ggml/

# Run all fuzzers (one at a time)
go test -fuzz=Fuzz -fuzztime=60s ./api/
go test -fuzz=Fuzz -fuzztime=60s ./openai/
go test -fuzz=Fuzz -fuzztime=60s ./fs/ggml/
go test -fuzz=Fuzz -fuzztime=60s ./server/
go test -fuzz=Fuzz -fuzztime=60s ./server/internal/cache/blob/
go test -fuzz=Fuzz -fuzztime=60s ./parser/
go test -fuzz=Fuzz -fuzztime=60s ./template/
go test -fuzz=Fuzz -fuzztime=60s ./convert/

Add 16 fuzz tests covering various parsing functions:

Binary/format parsers:
- FuzzGGUFDecode (fs/ggml) - GGUF binary format
- FuzzDetectContentType (fs/ggml) - content type detection

Type/string parsers:
- FuzzParseFileType (fs/ggml)
- FuzzParseTensorType (fs/ggml)
- FuzzParseDigest (server/internal/cache/blob)
- FuzzParseModelPath (server)

Text format parsers:
- FuzzParseFile (parser) - Modelfile parsing
- FuzzParse (template) - template parsing

JSON parsers:
- FuzzDurationUnmarshal (api)
- FuzzMessageUnmarshal (api)
- FuzzPropertyTypeUnmarshal (api)
- FuzzThinkValueUnmarshal (api)
- FuzzResponsesInputMessage (openai)
- FuzzResponsesInput (openai)
- FuzzSafetensorsMetadata (convert)

Run with: go test -fuzz=FuzzXxx -fuzztime=60s ./path/to/package/
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.

1 participant