Skip to content

mtmd: harden preprocessor_granite - #27235

Merged
ngxson merged 2 commits into
masterfrom
xsn/preprocessor_granite_harden
Aug 17, 2026
Merged

ngxson merged 2 commits into
masterfrom
xsn/preprocessor_granite_harden

Conversation

@ngxson

@ngxson ngxson commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Overview

Fix a small potential problem

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: yes, bug found & fixed by a security agent

@ngxson
ngxson requested a review from a team as a code owner August 17, 2026 08:49
@github-actions github-actions Bot added the mtmd Related to multimodal functionality (video/image/audio) label Aug 17, 2026

@CISC CISC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even this can overflow though.

Comment thread tools/mtmd/mtmd-image.cpp Outdated
const int grid_y = refined_size.height / tile_size;

// the stacked image is tile_size * (1 + grid_x*grid_y) tall, it must fit in an int
const int64_t stacked_h = (int64_t) tile_size * (1 + (int64_t) grid_x * grid_y);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const int64_t stacked_h = (int64_t) tile_size * (1 + (int64_t) grid_x * grid_y);
const uint64_t stacked_h = (uint64_t) tile_size * (1 + (uint64_t) grid_x * grid_y);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough, simply cap them to 1024 now, grid can never be that big: 49a5623

@ngxson
ngxson merged commit 9f0d017 into master Aug 17, 2026
25 of 27 checks passed
gabe-l-hart added a commit to gabe-l-hart/llama.cpp that referenced this pull request Aug 17, 2026
* origin/master: (86 commits)
ui: enforce alphabetical enum member ordering (ggml-org#27272)
ui: Refactor Built-In Tools naming (Server/Browser) (ggml-org#27271)
ci: more optimizations (ggml-org#26983)
doc: document MCP stdio servers and CORS defaults in the server README [no release] [no ci] (ggml-org#26847)
server: save processed mtmd chunks as placeholder (ggml-org#27278)
mtmd: use sha256 for input hashing (ggml-org#27274)
vocab : support integer tokenizer scores (ggml-org#27260)
mtmd : skip thumbnail for non-tiled LFM2 images (ggml-org#27246)
cuda : skip UMA override for HIP builds (ggml-org#27083)
vendor: move hash to vendor (ggml-org#27262)
ci : push release tag explicitly in release.yml (ggml-org#27261)
ui: move get_datetime tool to frontend (ggml-org#27255)
ci : reduce builds in build-xcframework.sh (ggml-org#27252)
model: support speculators-format checkpoints for DSpark (ggml-org#26275)
ui: add browser get_info tool (ggml-org#27251)
ci : restore release.yml check during make-release.yml (ggml-org#27247)
mtmd: harden preprocessor_granite (ggml-org#27235)
ci : allow make-release to target a specific commit (ggml-org#27234)
ci : make release workflows use a deploy key (ggml-org#27229)
convert: add @ModelBase.example (ggml-org#27208)
...
brittlewis12 pushed a commit to brittlewis12/llama.cpp that referenced this pull request Aug 17, 2026
* mtmd: harden preprocessor_granite

* simply cap to 1024
thecodacus pushed a commit to thecodacus/llama.cpp that referenced this pull request Sep 7, 2026
* mtmd: harden preprocessor_granite

* simply cap to 1024
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Sep 10, 2026
* mtmd: harden preprocessor_granite

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

Labels

mtmd Related to multimodal functionality (video/image/audio)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants