fix out-of-bounds read on truncated UTF-8 in wxUString::assignFromUTF8 (PR #26548)

7 views
Skip to first unread message

Javid Khan

unread,
Jun 1, 2026, 5:21:43 PM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed

The length-counting pass in the NUL-terminated assignFromUTF8 advances p by the lead byte's UTF-8 sequence length without checking those bytes are really there. A string ending in a truncated multibyte sequence (e.g. a lone 0xC3 before the NUL) skips p past the terminating NUL, so the while(p) test then reads past the end of the buffer. The assignFromUTF8(str, n) overload below already guards this via utf8_pos + len > n; this just adds the equivalent check for the terminated form. Reachable through wxUString::FromUTF8(const char).


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26548

Commit Summary

  • 49222b3 fix out-of-bounds read on truncated UTF-8 in wxUString::assignFromUTF8

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26548@github.com>

VZ

unread,
Jun 1, 2026, 5:45:03 PM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26548)

Thanks, will merge soon.

We really should have some unit tests for this class...


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26548/c4596760056@github.com>

VZ

unread,
Jun 1, 2026, 5:48:58 PM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed

Closed #26548 via 76991d2.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26548/issue_event/26208640402@github.com>

Reply all
Reply to author
Forward
0 new messages