Skip to content

[0.83] fix: null dereference in get_SelectionContainer when no selection container exists#16110

Merged
microsoft-github-policy-service[bot] merged 1 commit into0.83-stablefrom
83null
May 11, 2026
Merged

[0.83] fix: null dereference in get_SelectionContainer when no selection container exists#16110
microsoft-github-policy-service[bot] merged 1 commit into0.83-stablefrom
83null

Conversation

@vineethkuttan
Copy link
Copy Markdown
Contributor

@vineethkuttan vineethkuttan commented May 11, 2026

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Why

get_SelectionContainer (UIA SelectionItemPattern.SelectionContainer) crashes with a null dereference when the element has no ancestor with a selection container. GetSelectionContainer() walks the parent tree looking for a view with multiselectable and required props set; if none is found it returns nullptr, which was immediately dereferenced on the next line.

What

  • Added a null check on the return value of GetSelectionContainer() in get_SelectionContainer
  • Returns S_OK with *pRetVal == nullptr when no container is found — correct per UIA spec (element is simply not inside a selection container)
auto selectionContainerView = GetSelectionContainer();
// Per UIA spec, returning S_OK with *pRetVal == nullptr is correct when the element
// is not contained within a selection container.
if (!selectionContainerView)
  return S_OK;

Screenshots

N/A

Testing

Reproduced by calling get_SelectionContainer on a selection item whose ancestor tree contains no multiselectable container. Verified the null check prevents the crash and returns S_OK with a null provider pointer.

Changelog

Should this change be included in the release notes: yes

Fix crash (null dereference) in UIA SelectionItemPattern.get_SelectionContainer when the element has no selection

Microsoft Reviewers: Open in CodeFlow

…tainer exists (#16091)

* fix: null dereference in get_SelectionContainer when no container found

Agent-Logs-Url: https://github.com/microsoft/react-native-windows/sessions/dee66731-6253-459a-8ba1-f733d5bee554

Co-authored-by: vineethkuttan <66076509+vineethkuttan@users.noreply.github.com>

* Change files

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vineethkuttan <66076509+vineethkuttan@users.noreply.github.com>
@vineethkuttan vineethkuttan requested a review from a team as a code owner May 11, 2026 00:51
@vineethkuttan vineethkuttan changed the title fix: null dereference in get_SelectionContainer when no selection container exists [0.83] fix: null dereference in get_SelectionContainer when no selection container exists May 11, 2026
@vineethkuttan vineethkuttan added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label May 11, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot enabled auto-merge (squash) May 11, 2026 01:17
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Performance Test Results

Branch: 83null
Commit: 6584139d
Time: 2026-05-11T06:18:23.528Z
Tests: 158/161 passed

❌ Regressions Detected

SectionList

Scenario Baseline Current Change Status
SectionList rerender 11.60ms 15.40ms +47.6%

SectionList rerender: Duration increased by 47.6% / +5.00ms (threshold: 10% & 3ms)

Button

Scenario Baseline Current Change Status
Button multiple-50 22.40ms 31.60ms +33.3%
Button multiple-100 19.13ms 39.60ms +173.7%

Button multiple-50: Duration increased by 33.3% / +9.00ms (threshold: 15% & 5ms)
Button multiple-100: Duration increased by 173.7% / +33.00ms (threshold: 10% & 10ms)

⚠️ Tracked (not blocking)

Scenario Baseline Current Change
TouchableOpacity multiple-100 50.27ms 65.13ms +42.0%

✅ Passed

138 scenario(s) across 26 suite(s) — no regressions

FlatList

Scenario Mean Median StdDev Renders vs Baseline
FlatList mount 4.90ms 4.00ms ±1.85ms 1 +0.0%
FlatList unmount 0.10ms 0.00ms ±0.32ms 0 +0.0%
FlatList rerender 10.00ms 9.50ms ±2.11ms 2 +5.6%
FlatList with-10-items 5.10ms 5.00ms ±0.74ms 1 +25.0%
FlatList with-100-items 5.50ms 5.00ms ±1.65ms 1 +0.0%
FlatList with-500-items 4.70ms 4.50ms ±0.82ms 1 +12.5%
FlatList with-1000-items 5.10ms 5.00ms ±1.37ms 1 +25.0%
FlatList horizontal 4.30ms 4.50ms ±1.34ms 1 -10.0%
FlatList with-separator 2.20ms 2.00ms ±0.63ms 1 +0.0%
FlatList with-header-footer 1.80ms 2.00ms ±0.42ms 1 +0.0%
FlatList with-empty-list 0.50ms 0.50ms ±0.53ms 1 +0.0%
FlatList with-get-item-layout 1.80ms 2.00ms ±0.79ms 1 +100.0%
FlatList inverted 1.90ms 1.00ms ±1.85ms 1 -33.3%
FlatList with-num-columns 3.00ms 3.00ms ±0.67ms 1 +0.0%

TouchableOpacity

Scenario Mean Median StdDev Renders vs Baseline
TouchableOpacity mount 0.80ms 1.00ms ±0.42ms 1 +0.0%
TouchableOpacity unmount 0.10ms 0.00ms ±0.32ms 0 +0.0%
TouchableOpacity rerender 1.80ms 1.50ms ±1.23ms 2 +50.0%
TouchableOpacity custom-active-opacity 0.90ms 1.00ms ±0.32ms 1 +0.0%
TouchableOpacity disabled 0.60ms 1.00ms ±0.52ms 1 +0.0%
TouchableOpacity with-all-handlers 0.50ms 0.50ms ±0.53ms 1 -50.0%
TouchableOpacity with-hit-slop 1.10ms 1.00ms ±0.32ms 1 +0.0%
TouchableOpacity with-delay 0.80ms 1.00ms ±0.42ms 1 +0.0%
TouchableOpacity nested 2.00ms 2.00ms ±1.49ms 1 +100.0%
TouchableOpacity multiple-10 6.60ms 6.00ms ±1.59ms 1 +0.0%
TouchableOpacity multiple-50 31.87ms 31.00ms ±3.09ms 1 +6.9%
TouchableOpacity multiple-100 65.13ms 71.00ms ±14.55ms 1 +42.0%

ScrollView

Scenario Mean Median StdDev Renders vs Baseline
ScrollView mount 0.30ms 0.00ms ±0.48ms 1 +0.0%
ScrollView unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
ScrollView rerender 0.40ms 0.00ms ±0.52ms 2 -100.0%
ScrollView children-20 3.53ms 3.00ms ±1.36ms 1 -25.0%
ScrollView children-100 17.07ms 16.00ms ±3.10ms 1 +0.0%
ScrollView horizontal 3.20ms 3.00ms ±1.03ms 1 -25.0%
ScrollView sticky-headers 2.90ms 3.00ms ±1.10ms 1 +0.0%
ScrollView scroll-indicators 0.80ms 1.00ms ±0.42ms 1 +0.0%
ScrollView nested 1.40ms 1.00ms ±0.52ms 1 +0.0%
ScrollView content-container-style 1.20ms 1.00ms ±1.40ms 1 +0.0%
ScrollView children-500 21.07ms 20.00ms ±3.43ms 1 +5.3%

TouchableHighlight

Scenario Mean Median StdDev Renders vs Baseline
TouchableHighlight mount 0.60ms 1.00ms ±0.52ms 1 +100.0%
TouchableHighlight unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
TouchableHighlight rerender 0.60ms 1.00ms ±0.52ms 2 +0.0%
TouchableHighlight custom-underlay-color 0.50ms 0.50ms ±0.53ms 1 +Infinity%
TouchableHighlight custom-active-opacity 0.30ms 0.00ms ±0.48ms 1 +0.0%
TouchableHighlight disabled 0.30ms 0.00ms ±0.48ms 1 +0.0%
TouchableHighlight with-all-handlers 0.30ms 0.00ms ±0.48ms 1 +0.0%
TouchableHighlight with-hit-slop 0.50ms 0.50ms ±0.53ms 1 +Infinity%
TouchableHighlight nested-touchables 1.40ms 1.00ms ±1.26ms 1 +0.0%
TouchableHighlight multiple-touchables-10 2.80ms 3.00ms ±0.42ms 1 +0.0%
TouchableHighlight multiple-touchables-50 15.10ms 15.00ms ±2.28ms 1 +20.0%
TouchableHighlight multiple-touchables-100 25.40ms 25.50ms ±3.81ms 1 +13.3%

Pressable

Scenario Mean Median StdDev Renders vs Baseline
Pressable mount 0.50ms 0.50ms ±0.53ms 1 +Infinity%
Pressable unmount 0.10ms 0.00ms ±0.32ms 0 +0.0%
Pressable rerender 0.50ms 0.50ms ±0.53ms 2 +0.0%
Pressable with-all-handlers 0.50ms 0.50ms ±0.53ms 1 +Infinity%
Pressable with-style-function 0.50ms 0.50ms ±0.53ms 1 +Infinity%
Pressable disabled 0.30ms 0.00ms ±0.48ms 1 +0.0%
Pressable with-hit-slop 0.30ms 0.00ms ±0.48ms 1 +0.0%
Pressable nested 0.70ms 1.00ms ±0.48ms 1 +0.0%
Pressable multiple-10 3.00ms 3.00ms ±0.38ms 1 +0.0%
Pressable multiple-50 16.40ms 16.00ms ±1.68ms 1 +14.3%
Pressable multiple-100 18.20ms 13.00ms ±10.50ms 1 +8.3%

Modal

Scenario Mean Median StdDev Renders vs Baseline
Modal mount 0.30ms 0.00ms ±0.48ms 1 +0.0%
Modal unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
Modal rerender 1.00ms 1.00ms ±1.15ms 2 +Infinity%
Modal slide-animation 0.30ms 0.00ms ±0.48ms 1 +0.0%
Modal fade-animation 0.30ms 0.00ms ±0.48ms 1 +0.0%
Modal transparent 0.30ms 0.00ms ±0.48ms 1 +0.0%
Modal with-callbacks 0.60ms 1.00ms ±0.52ms 1 +Infinity%
Modal rich-content 1.50ms 1.50ms ±0.53ms 1 -25.0%
Modal with-accessibility 0.50ms 0.00ms ±0.71ms 1 +0.0%

Image

Scenario Mean Median StdDev Renders vs Baseline
Image mount 0.10ms 0.00ms ±0.32ms 1 +0.0%
Image unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
Image rerender 0.10ms 0.00ms ±0.32ms 2 +0.0%
Image with-resize-mode 0.20ms 0.00ms ±0.42ms 1 +0.0%
Image with-border-radius 0.20ms 0.00ms ±0.42ms 1 +0.0%
Image with-tint-color 0.00ms 0.00ms ±0.00ms 1 +0.0%
Image with-blur-radius 0.20ms 0.00ms ±0.42ms 1 +0.0%
Image with-accessibility 0.10ms 0.00ms ±0.32ms 1 +0.0%
Image multiple-10 1.20ms 1.00ms ±0.56ms 1 +0.0%
Image multiple-50 4.53ms 4.00ms ±0.83ms 1 +33.3%
Image multiple-100 9.73ms 10.00ms ±1.58ms 1 +25.0%

ActivityIndicator

Scenario Mean Median StdDev Renders vs Baseline
ActivityIndicator mount 0.20ms 0.00ms ±0.42ms 1 +0.0%
ActivityIndicator unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
ActivityIndicator rerender 0.40ms 0.00ms ±0.52ms 2 +0.0%
ActivityIndicator size-large 0.20ms 0.00ms ±0.42ms 1 +0.0%
ActivityIndicator size-small 0.10ms 0.00ms ±0.32ms 1 +0.0%
ActivityIndicator with-color 0.40ms 0.00ms ±0.52ms 1 +0.0%
ActivityIndicator not-animating 0.00ms 0.00ms ±0.00ms 1 +0.0%
ActivityIndicator with-accessibility 0.00ms 0.00ms ±0.00ms 1 +0.0%
ActivityIndicator multiple-10 1.13ms 1.00ms ±0.52ms 1 +0.0%
ActivityIndicator multiple-50 4.80ms 4.00ms ±1.52ms 1 +0.0%
ActivityIndicator multiple-100 10.87ms 11.00ms ±2.17ms 1 +57.1%

Switch

Scenario Mean Median StdDev Renders vs Baseline
Switch mount 0.30ms 0.00ms ±0.48ms 1 +0.0%
Switch unmount 0.10ms 0.00ms ±0.32ms 0 +0.0%
Switch rerender 0.40ms 0.00ms ±0.52ms 2 -100.0%
Switch value-true 0.40ms 0.00ms ±0.52ms 1 +0.0%
Switch disabled 0.30ms 0.00ms ±0.48ms 1 +0.0%
Switch custom-colors 0.30ms 0.00ms ±0.48ms 1 +0.0%
Switch on-value-change 0.30ms 0.00ms ±0.48ms 1 +0.0%
Switch with-accessibility 0.20ms 0.00ms ±0.42ms 1 +0.0%
Switch multiple-10 1.60ms 2.00ms ±0.51ms 1 +0.0%
Switch multiple-50 10.53ms 11.00ms ±2.75ms 1 +22.2%
Switch multiple-100 23.00ms 22.00ms ±3.82ms 1 +37.5%

TextInput

Scenario Mean Median StdDev Renders vs Baseline
TextInput mount 0.20ms 0.00ms ±0.42ms 1 +0.0%
TextInput unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
TextInput rerender 0.10ms 0.00ms ±0.32ms 2 +0.0%
TextInput multiline 0.10ms 0.00ms ±0.32ms 1 +0.0%
TextInput with-value 0.00ms 0.00ms ±0.00ms 1 +0.0%
TextInput styled 0.50ms 0.00ms ±1.27ms 1 +0.0%
TextInput multiple-100 8.07ms 8.00ms ±1.49ms 1 +14.3%

View

Scenario Mean Median StdDev Renders vs Baseline
View mount 0.20ms 0.00ms ±0.42ms 1 +0.0%
View unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
View rerender 0.10ms 0.00ms ±0.32ms 2 +0.0%
View nested-50 3.87ms 4.00ms ±0.52ms 1 +33.3%
View nested-100 8.67ms 8.00ms ±1.91ms 1 +14.3%
View shadow 0.10ms 0.00ms ±0.32ms 1 +0.0%
View border-radius 0.20ms 0.00ms ±0.42ms 1 +0.0%
View nested-500 17.47ms 11.00ms ±12.35ms 1 +10.0%

Text

Scenario Mean Median StdDev Renders vs Baseline
Text mount 0.20ms 0.00ms ±0.42ms 1 +0.0%
Text unmount 0.00ms 0.00ms ±0.00ms 0 +0.0%
Text rerender 0.10ms 0.00ms ±0.32ms 2 +0.0%
Text long-1000 0.20ms 0.00ms ±0.42ms 1 +0.0%
Text nested 0.20ms 0.00ms ±0.42ms 1 +0.0%
Text styled 0.10ms 0.00ms ±0.32ms 1 +0.0%
Text multiple-100 8.53ms 9.00ms ±1.60ms 1 +28.6%

SectionList.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
SectionList native mount 5.24ms 5.21ms ±0.92ms 1 -19.9%

FlatList.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
FlatList native mount 4.87ms 4.30ms ±0.98ms 1 -53.4%

TouchableHighlight.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
TouchableHighlight native mount 1.47ms 1.40ms ±0.21ms 1 -32.8%

TouchableOpacity.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
TouchableOpacity native mount 1.71ms 1.62ms ±0.21ms 1 -48.3%

Pressable.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
Pressable native mount 1.57ms 1.41ms ±0.40ms 1 -43.6%

ScrollView.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
ScrollView native mount 3.44ms 3.03ms ±0.74ms 1 -25.2%

ActivityIndicator.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
ActivityIndicator native mount 1.24ms 1.17ms ±0.15ms 1 -52.9%

TextInput.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
TextInput native mount 2.00ms 1.82ms ±0.48ms 1 -55.5%

Switch.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
Switch native mount 1.17ms 1.04ms ±0.27ms 1 -40.2%

Button.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
Button native mount 1.77ms 1.65ms ±0.27ms 1 -36.5%

Modal.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
Modal native mount 0.88ms 0.87ms ±0.04ms 1 -28.6%

Image.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
Image native mount 1.74ms 1.62ms ±0.48ms 1 -28.5%

View.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
View native mount 1.08ms 1.01ms ±0.22ms 1 -29.5%

Text.native-perf-test.ts

Scenario Mean Median StdDev Renders vs Baseline
Text native mount 1.16ms 1.16ms ±0.03ms 1 -33.6%

Copy link
Copy Markdown
Contributor

@Nitin-100 Nitin-100 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@iamAbhi-916 iamAbhi-916 left a comment

Choose a reason for hiding this comment

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

LGTM

@microsoft-github-policy-service microsoft-github-policy-service Bot merged commit 0ec67eb into 0.83-stable May 11, 2026
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants