litert/xnnpack: guard against zero input dimension in ResizeNearestNeighborOperation::ToXnnpack() - #11055
Open
destro4evr-rgb wants to merge 1 commit into
Open
Conversation
qukhan
approved these changes
Aug 26, 2026
This was referenced Aug 26, 2026
Contributor
Author
Collaborator
|
Looks like there's a merge conflict internally. Can you try rebasing onto the main branch? |
…ighbor input_h and input_w are read directly from the flatbuffer shape field and used as integer divisors in the modulo and division operations at lines 1483-1489. A crafted model with a zero height or width triggers SIGFPE (integer divide-by-zero) during XNNPACK subgraph compilation at model load time. Add an explicit non-zero check before the first use of either value.
destro4evr-rgb
force-pushed
the
fix/resize-nearest-neighbor-sigfpe
branch
from
August 31, 2026 16:09
53e041a to
d37e157
Compare
Contributor
Author
copybara-service Bot
pushed a commit
to google-ai-edge/LiteRT
that referenced
this pull request
Aug 31, 2026
-- d37e157a165998c9edf771d2692ce132c2a75086 by destro4evr-rgb <destro4evr@proton.me>: litert/xnnpack: guard against zero input dimension in ResizeNearestNeighbor input_h and input_w are read directly from the flatbuffer shape field and used as integer divisors in the modulo and division operations at lines 1483-1489. A crafted model with a zero height or width triggers SIGFPE (integer divide-by-zero) during XNNPACK subgraph compilation at model load time. Add an explicit non-zero check before the first use of either value. FUTURE_COPYBARA_INTEGRATE_REVIEW=google/XNNPACK#11055 from destro4evr-rgb:fix/resize-nearest-neighbor-sigfpe d37e157a165998c9edf771d2692ce132c2a75086 LiteRT-PiperOrigin-RevId: 971398177
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 1, 2026
-- d37e157 by destro4evr-rgb <destro4evr@proton.me>: litert/xnnpack: guard against zero input dimension in ResizeNearestNeighbor input_h and input_w are read directly from the flatbuffer shape field and used as integer divisors in the modulo and division operations at lines 1483-1489. A crafted model with a zero height or width triggers SIGFPE (integer divide-by-zero) during XNNPACK subgraph compilation at model load time. Add an explicit non-zero check before the first use of either value. FUTURE_COPYBARA_INTEGRATE_REVIEW=#11055 from destro4evr-rgb:fix/resize-nearest-neighbor-sigfpe d37e157 PiperOrigin-RevId: 971398177
copybara-service Bot
pushed a commit
to google-ai-edge/LiteRT
that referenced
this pull request
Sep 1, 2026
-- d37e157a165998c9edf771d2692ce132c2a75086 by destro4evr-rgb <destro4evr@proton.me>: litert/xnnpack: guard against zero input dimension in ResizeNearestNeighbor input_h and input_w are read directly from the flatbuffer shape field and used as integer divisors in the modulo and division operations at lines 1483-1489. A crafted model with a zero height or width triggers SIGFPE (integer divide-by-zero) during XNNPACK subgraph compilation at model load time. Add an explicit non-zero check before the first use of either value. Reverts 71dd844 FUTURE_COPYBARA_INTEGRATE_REVIEW=google/XNNPACK#11055 from destro4evr-rgb:fix/resize-nearest-neighbor-sigfpe d37e157a165998c9edf771d2692ce132c2a75086 LiteRT-PiperOrigin-RevId: 971398177
Contributor
Author
Collaborator
|
I'm still working towards getting them through. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ResizeNearestNeighborOperation::ToXnnpack()readsinput_handinput_wdirectly from the flatbuffer shape field and uses them as integer divisors in modulo and division operations (lines 1483–1489) without checking for zero. A crafted model with an input tensor whose height or width is 0 triggers SIGFPE during XNNPACK subgraph compilation at model load time - before any inference runs.The sibling
ResizeBilinearOperation::ToXnnpack()passes dimensions directly toxnn_define_static_resize_bilinear_2dwithout any division and is not affected. This function uniquely computes an integer scale factor via division and had no guard for a zero divisor.Fix: add an explicit non-zero check for
input_handinput_wimmediately after they are read, before the first modulo operation.