Skip to content

fix: crash when sending image under 2x2 pixels#21711

Merged
ngxson merged 3 commits intoggml-org:masterfrom
mzsergiu:master
Apr 12, 2026
Merged

fix: crash when sending image under 2x2 pixels#21711
ngxson merged 3 commits intoggml-org:masterfrom
mzsergiu:master

Conversation

@mzsergiu
Copy link
Copy Markdown
Contributor

Overview

GGML_ASSERT(src.nx >= 2 && src.ny >= 2); will crash llama.cpp when processing very small images. Fix was implemented to handle 1x1 inputs safely by updating the interpolation math and clamping pixel lookups, preventing out-of-bounds memory errors while keeping the pipeline stable.

Code was succesfully tested in production, llama-server is running with no crashes.

Additional information

Fixes #21420

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - gpt-oss-120b was used for debug and code update.

@mzsergiu mzsergiu requested a review from a team as a code owner April 10, 2026 06:07
@ngxson
Copy link
Copy Markdown
Contributor

ngxson commented Apr 11, 2026

Can someone give a 2nd approval? Thanks! @CISC @pwilkin

@ngxson ngxson merged commit 82764d8 into ggml-org:master Apr 12, 2026
47 checks passed
crodjer added a commit to crodjer/llama.cpp that referenced this pull request Apr 13, 2026
* origin/master:
  webui: MCP Diagnostics improvements (ggml-org#21803)
  Remove extra conditional check on debug mode. (ggml-org#21798)
  sycl: disable Q1_0 in backend and cleanup unused variables (ggml-org#21807)
  mtmd: fix crash when sending image under 2x2 pixels (ggml-org#21711)
  mtmd: qwen3 audio support (qwen3-omni and qwen3-asr) (ggml-org#19441)
  convert : force f16 or f32 on step3-vl conv weights (ggml-org#21646)
  mtmd: add gemma 4 test (vision + audio) [no ci] (ggml-org#21806)
  mtmd: add Gemma 4 audio conformer encoder support (ggml-org#21421)
  fix: Proper messages rendering for "Show raw output" (ggml-org#21672)
  docs: add guide on how to add multimodal support (ggml-org#21778)
HermestoAizales pushed a commit to HermestoAizales/llama.cpp that referenced this pull request Apr 13, 2026
ArberSephirotheca pushed a commit to ArberSephirotheca/llama.cpp that referenced this pull request Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: gemma-4-26B-A4B crashing (openweb-ui -> litellm -> llama.cpp version: 8661 (b7ad48ebd)

3 participants