Skip to content

[VFS] Guard against null key/value nodes when parsing YAML overlay (#190506)#12722

Merged
mustartt merged 1 commit intostable/21.xfrom
hjiang/yaml-vfs-overlay-crash
Apr 13, 2026
Merged

[VFS] Guard against null key/value nodes when parsing YAML overlay (#190506)#12722
mustartt merged 1 commit intostable/21.xfrom
hjiang/yaml-vfs-overlay-crash

Conversation

@mustartt
Copy link
Copy Markdown

@mustartt mustartt commented Apr 7, 2026

When a VFS overlay YAML file contains malformed content such as tabs, the YAML parser can produce KeyValueNode entries where getKey returns nullptr. The VFS overlay parser then passes the nullptr to parseScalarString, which then calls dyn_cast.

Switch to dyn_cast_if_present for the above callsites and a few more.

(cherry picked from commit 412d694)
rdar://171640245

…lvm#190506)

When a VFS overlay YAML file contains malformed content such as tabs,
the YAML parser can produce KeyValueNode entries where `getKey` returns
nullptr. The VFS overlay parser then passes the nullptr to
`parseScalarString`, which then calls dyn_cast.

Switch to `dyn_cast_if_present` for the above callsites and a few more.

(cherry picked from commit 412d694)
@mustartt mustartt requested a review from a team as a code owner April 7, 2026 04:48
@mustartt
Copy link
Copy Markdown
Author

mustartt commented Apr 7, 2026

@swift-ci please test

@mustartt mustartt merged commit 2e928cb into stable/21.x Apr 13, 2026
3 checks passed
@mustartt mustartt deleted the hjiang/yaml-vfs-overlay-crash branch April 13, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants