Skip to content

Check if length is greater than the buffer size, not if it is greater than count.#5333

Open
SiliconA-Z wants to merge 1 commit intoswiftlang:mainfrom
SiliconA-Z:patch-3
Open

Check if length is greater than the buffer size, not if it is greater than count.#5333
SiliconA-Z wants to merge 1 commit intoswiftlang:mainfrom
SiliconA-Z:patch-3

Conversation

@SiliconA-Z
Copy link
Copy Markdown
Contributor

The ICU function ulistfmt_format returns the required buffer length.
If the required length is greater than the buffer we provided (RESULT_BUFFER_SIZE, which is 768), then truncation occurred (or would occur).

Therefore, the check must be length > RESULT_BUFFER_SIZE.

@parkera parkera requested a review from itingliu January 28, 2026 18:41
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.

1 participant