CVE-2026-5885
Overview
Files Changed
services/webnn/ort/graph_builder_ort.cc
Patch
From bf5c0c7bfac1e6fde12d7c903c88c2632d8aa8fe Mon Sep 17 00:00:00 2001 From: Bryan Bernhart <[email protected]> Date: Fri, 20 Feb 2026 13:26:41 -0800 Subject: [PATCH] WebNN: handle empty axes in ORT reverse operation Previously, the ORT graph builder would attempt to generate a Slice node with zero axes, which could lead to backend-specific crashes in certain EPs. This CL ensures that empty axes are handled by emitting an Identity node instead, maintaining spec compliance and preventing potential OOB access during graph initialization. Bug: 485203823 Change-Id: I80b310cb3609beb7907ab8ffbc823af1c6c74a90 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7595579 Reviewed-by: Reilly Grant <[email protected]> Commit-Queue: Bernhart, Bryan <[email protected]> Cr-Commit-Position: refs/heads/main@{#1588047} --- diff --git a/services/webnn/ort/graph_builder_ort.cc b/services/webnn/ort/graph_builder_ort.cc index 4126bbe..131a0046 100644 --- a/services/webnn/ort/graph_builder_ort.cc +++ b/services/webnn/ort/graph_builder_ort.cc @@ -2781,13 +2781,26 @@ } void GraphBuilderOrt::AddReverseOperation(const mojom::Reverse& reverse) { - const std::string node_name = GenerateNodeName(reverse.label); const std::string input = GetOperandNameById(reverse.input_operand_id); const std::string output = GetOperandNameById(reverse.output_operand_id); CHECK(context_properties_.data_type_limits.reverse_input.Supports( GetOperand(reverse.input_operand_id).descriptor)); + // Workaround: explicitly empty axes for a reverse operation should result in + // a no-op per spec. But we map this to an Identity node to prevent ORT + // EPs from mishandling empty arrays. + if (reverse.axes.empty()) { + const std::string node_name = GenerateNodeName(base::JoinString( + {kInserted, kOpTypeIdentity, kToEmulate, reverse.label}, kUnderscore)); + std::array<const char*, 1> inputs = {input.c_str()}; + std::array<const char*, 1> outputs = {output.c_str()}; + model_editor_.AddNode(kOpTypeIdentity, node_name, inputs, outputs); + return; + } + + const std::string node_name = GenerateNodeName(reverse.label); + // Axes can be empty, which means no dimensions are reversed. base::FixedArray<int64_t> axes(reverse.axes.begin(), reverse.axes.end()); size_t axes_size = axes.size();
Original Bug Report
[ORT] GPU process AV during reverse with empty axes
Latest stable release of WinML (OpenVINO EP 1.8 / OV 2025.4) contains a deterministic GPU process crash when executing a WebNN reverse operation with an empty axes array (options.axes = []).
Reproduction WPT:
https://wpt.live/webnn/conformance_tests/reverse.https.any.html?device=gpu&tc=reverse%20float32%204D%20input%20options.axes=%5b%5d
The crash results into a STATUS_ACCESS_VIOLATION due to an unchecked iterator dereference. OpenVINO attempts to find the max. axis index to calculate the required buffer length: length = *std::max_element(axis.begin(), axis.end()). When axis is empty, std::max_element returns the end() iterator. The subsequent dereference (*) attempts to read invalid memory, triggering an immediate hardware-level fault.
The issue is verified as fixed in OpenVINO nightly (due for OV 2026.1), but the fix has not been backported to the stable OV EP release or delivered to Chromium.