Skip to content

mtmd: one-sample audio input causes process abort #27693

Description

@hera2019

Name and Version

version: 0.2.0-dev (build 10618, commit eb25b72)
built with AppleClang 21.0.0.21000101 for Darwin arm64

Operating systems

Mac

Which llama.cpp modules do you know to be affected?

libllama (core library), llama-cli, llama-server

Command line

llama-server -hf ggml-org/Voxtral-Mini-3B-2507-GGUF --port 18080 -c 4096
# Then send a request to /v1/chat/completions with a single-sample WAV file provided as input_audio.

Problem description & steps to reproduce

When a WAV file containing is exactly one sample, the process aborts at mtmd.cpp:1553 GGML_ASSERT(buf.size() > sizeof(float)). Because one float occupies 4 bytes, the buffer size is also 4 bytes, the condition evaluates to false (4 > 4 is false).
I verified the crash on Voxtral; the assertion sits on the shared path before the per-model preprocessor is selected, so it should affect all audio models.
The Whisper preprocessor is designed to zero-pad very short audio clips. Therefore, regardless of whether such extremely short input should ultimately be accepted or result in an error, a single request should not trigger an assertion that kills the entire server process. The erroneous assertion causes the entire server process to abort instead of returning an error for the request.

Steps to reproduce:

  1. Build any recent master with audio-capable mtmd.
  2. Create a 1-sample 16 kHz mono WAV (see attached script).
  3. Feed it to llama-mtmd-cli, or POST it to llama-server as input_audio.
  4. CLI aborts with exit code 134; the server process dies and /health stops responding.

AI usage disclosure: I used an AI assistant to help troubleshoot this bug and draft this report. I personally reproduced and verified the crash and also understand the relevant code.

First Bad Commit

Not bisected. The assertion is long-standing and was not touched by the recent
short-input fix (#26536), which changed min_samples inside the preprocessor but
not this buffer-size guard at the tokenizer entry.

Relevant log output

Logs
tools/mtmd/mtmd.cpp:1553: GGML_ASSERT(buf.size() > sizeof(float)) failed

0   ggml_abort
1   GGML_ASSERT(buf.size() > sizeof(float))          [mtmd.cpp:1553]
2   handle_completions_impl                          [server]
3   httplib::Server::process_request
4   httplib::ThreadPool::worker

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions