Skip to content

fix(rpc): prevent division by zero in deserialize_tensor#20712

Merged
rgerganov merged 2 commits intoggml-org:masterfrom
y198nt:patch-2
Mar 21, 2026
Merged

fix(rpc): prevent division by zero in deserialize_tensor#20712
rgerganov merged 2 commits intoggml-org:masterfrom
y198nt:patch-2

Conversation

@y198nt
Copy link
Copy Markdown
Contributor

@y198nt y198nt commented Mar 18, 2026

When receiving an RPC message with a deprecated tensor type (e.g., type 4 or 5 where blck_size == 0), ggml_row_size() will trigger a division by zero (SIGFPE) and crash the rpc-server.

This patch adds a simple validation check in deserialize_tensor to return nullptr if the requested tensor type has a block size of 0.

(Note: This was originally reported via Security Advisory and maintainer suggested dropping a patch here).

Make sure to read the contributing guidelines before submitting a PR

When receiving an RPC message with a deprecated tensor type (e.g., type 4 or 5 where `blck_size == 0`), `ggml_row_size()` will trigger a division by zero (SIGFPE) and crash the rpc-server. 

This patch adds a simple validation check in `deserialize_tensor` to return `nullptr` if the requested tensor type has a block size of 0.

(Note: This was originally reported via Security Advisory and maintainer suggested dropping a patch here).
@y198nt y198nt requested a review from a team as a code owner March 18, 2026 08:30
@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Mar 18, 2026
Copy link
Copy Markdown
Member

@rgerganov rgerganov left a comment

Choose a reason for hiding this comment

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

ggml_blck_size performs a simple array lookup, so this shouldn't have performance impact. looks good to me.

@rgerganov rgerganov merged commit 2bcdddd into ggml-org:master Mar 21, 2026
47 of 48 checks passed
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
)

rpc : prevent division by zero in deserialize_tensor

When receiving an RPC message with a deprecated tensor type (e.g., type 4 or 5 where `blck_size == 0`), `ggml_row_size()` will trigger a division by zero (SIGFPE) and crash the rpc-server. 

This patch adds a simple validation check in `deserialize_tensor` to return `nullptr` if the requested tensor type has a block size of 0.

(Note: This was originally reported via Security Advisory and maintainer suggested dropping a patch here).

* style: remove trailing whitespace
rsenthilkumar6 pushed a commit to rsenthilkumar6/llama.cpp that referenced this pull request May 1, 2026
)

rpc : prevent division by zero in deserialize_tensor

When receiving an RPC message with a deprecated tensor type (e.g., type 4 or 5 where `blck_size == 0`), `ggml_row_size()` will trigger a division by zero (SIGFPE) and crash the rpc-server. 

This patch adds a simple validation check in `deserialize_tensor` to return `nullptr` if the requested tensor type has a block size of 0.

(Note: This was originally reported via Security Advisory and maintainer suggested dropping a patch here).

* style: remove trailing whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants