JS: Add regression test for YAML extraction

SnakeYAML 2.3 has [a bug](https://bitbucket.org/snakeyaml/snakeyaml/issues/1098) where it crashes with an `IndexOutOfBoundsException` when a Unicode surrogate pair (e.g. an emoji) straddles the 1024 character internal buffer boundary.  This happens because the high surrogate can end up as the last character in the data window, and the reader tries to read the low surrogate past the end of the buffer.

This caused languages that extract YAML, most notably JavaScript and Actions, to fail when the codebase contained a YAML file with an emoji at an unlucky position in the file.
This commit is contained in:
Henry Mercer
2026-03-24 18:47:52 +00:00
parent 0ed037d667
commit c9fcdf3e80
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
key: 🚀

View File

@@ -0,0 +1,27 @@
#10000=@"/emoji_buffer_boundary.yml;sourcefile"
files(#10000,"/emoji_buffer_boundary.yml")
#10001=@"/;folder"
folders(#10001,"/")
containerparent(#10001,#10000)
#10002=@"loc,{#10000},0,0,0,0"
locations_default(#10002,#10000,0,0,0,0)
hasLocation(#10000,#10002)
#20000=*
#20001=*
yaml_scalars(#20001,0,"key")
yaml(#20001,0,#20000,1,"tag:yaml.org,2002:str","key")
#20002=@"loc,{#10000},2,1,2,3"
locations_default(#20002,#10000,2,1,2,3)
yaml_locations(#20001,#20002)
#20003=*
yaml_scalars(#20003,0,"🚀")
yaml(#20003,0,#20000,-1,"tag:yaml.org,2002:str","\u1f680\ude80")
#20004=@"loc,{#10000},2,6,2,6"
locations_default(#20004,#10000,2,6,2,6)
yaml_locations(#20003,#20004)
yaml(#20000,1,#10000,0,"tag:yaml.org,2002:map","key: \u1f680\ude80")
#20005=@"loc,{#10000},2,1,2,8"
locations_default(#20005,#10000,2,1,2,8)
yaml_locations(#20000,#20005)
numlines(#10000,2,0,0)
filetype(#10000,"yaml")