[PR #13520] Add fuzz tests for parsers #14253

Open
opened 2026-04-13 00:49:20 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13520
Author: @skypher
Created: 12/18/2025
Status: 🔄 Open

Base: mainHead: add-security-fuzzers


📝 Commits (1)

  • 4e21084 Add fuzz tests for parsers

📊 Changes

9 files changed (+600 additions, -0 deletions)

View changed files

📝 api/types_test.go (+120 -0)
📝 convert/reader_test.go (+50 -0)
📝 fs/ggml/ggml_test.go (+73 -0)
📝 fs/ggml/gguf_test.go (+135 -0)
📝 openai/responses_test.go (+50 -0)
📝 parser/parser_test.go (+48 -0)
📝 server/internal/cache/blob/digest_test.go (+44 -0)
📝 server/modelpath_test.go (+43 -0)
📝 template/template_test.go (+37 -0)

📄 Description

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/

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13520 **Author:** [@skypher](https://github.com/skypher) **Created:** 12/18/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `add-security-fuzzers` --- ### 📝 Commits (1) - [`4e21084`](https://github.com/ollama/ollama/commit/4e210841161c1c20e2bebca93e8c0fe1860c48a6) Add fuzz tests for parsers ### 📊 Changes **9 files changed** (+600 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `api/types_test.go` (+120 -0) 📝 `convert/reader_test.go` (+50 -0) 📝 `fs/ggml/ggml_test.go` (+73 -0) 📝 `fs/ggml/gguf_test.go` (+135 -0) 📝 `openai/responses_test.go` (+50 -0) 📝 `parser/parser_test.go` (+48 -0) 📝 `server/internal/cache/blob/digest_test.go` (+44 -0) 📝 `server/modelpath_test.go` (+43 -0) 📝 `template/template_test.go` (+37 -0) </details> ### 📄 Description ## 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 ```bash # 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/ ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:49:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#14253