You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tag_no_case function can panic whenever a character in a to be matched string lowercases to a character with a shorter byte pattern.
In the above example the K to be matched is actually the kelvin sign with the UTF-8 byte pattern of 0xE2 0x84 0xAA. This character has a the normal single byte k as its lowercase character and therefore matches the tag.
The tag_no_case implementation, after matching a string to the tag, splits the given string with the length of the tag:
This assumes that the length in bytes of the matched characters is the same as the tag it was matched to. But, as in the above example, this is not always the case, resulting in the function sometimes trying to split a string outside of a character boundary and panicking
The text was updated successfully, but these errors were encountered:
1.75.0
Test case
The
tag_no_case
function can panic whenever a character in a to be matched string lowercases to a character with a shorter byte pattern.In the above example the K to be matched is actually the kelvin sign with the UTF-8 byte pattern of
0xE2 0x84 0xAA
. This character has a the normal single byte k as its lowercase character and therefore matches the tag.The
tag_no_case
implementation, after matching a string to the tag, splits the given string with the length of the tag:nom/src/bytes/mod.rs
Line 76 in e87c7da
This assumes that the length in bytes of the matched characters is the same as the tag it was matched to. But, as in the above example, this is not always the case, resulting in the function sometimes trying to split a string outside of a character boundary and panicking
The text was updated successfully, but these errors were encountered: