fix out-of-bounds read on trailing % in wxDateTime::Format (PR #26543)

28 views
Skip to first unread message

Javid Khan

unread,
Jun 1, 2026, 10:26:02 AM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed

Fuzzing date format strings turned this up. Format() does (*++p) when it hits a '%', so a format ending in a lone '%' advances the iterator onto end(), and then the for-loop's own ++p steps one past it; since end()+1 != end() the loop re-enters and reads *p past the terminating NUL. It asserts in debug builds via the existing case 0, but over-reads the format buffer in release. Advance once and output the trailing '%' verbatim then stop, which is what the case 0 comment already intended. ParseFormat() already handles this by returning false.


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

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

Commit Summary

  • 1b89f0b fix out-of-bounds read on trailing % in wxDateTime::Format

File Changes

(2 files)

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/26543@github.com>

VZ

unread,
Jun 1, 2026, 11:03:44 AM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26543)

Thanks! The fix looks correct but MSVC standard library doesn't like invalid format strings, apparently, making the CI jobs using it fail. The simplest is to just skip/disable this test when using it, could you please do it?


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/26543/c4593839573@github.com>

Javid Khan

unread,
Jun 2, 2026, 12:10:05 AM (yesterday) Jun 2
to wx-...@googlegroups.com, Push

@dxbjavid pushed 1 commit.

  • e9c8816 Skip trailing % format test with MSVC CRT


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/26543/before/1b89f0b281a55c8a7bbad7535f9c06a30f71e890/after/e9c8816594e247f018fb6642fbbeec9137bf0486@github.com>

Javid Khan

unread,
Jun 2, 2026, 12:10:09 AM (yesterday) Jun 2
to wx-...@googlegroups.com, Subscribed
dxbjavid left a comment (wxWidgets/wxWidgets#26543)

Done, wrapped the new check in #ifndef _MSC_VER so it's skipped with the MSVC CRT. The fix itself is unaffected.


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/26543/c4598640689@github.com>

VZ

unread,
Jun 2, 2026, 8:48:03 AM (yesterday) Jun 2
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26543)

Sorry, I should have thought about this, but MSVC CRT is also used with MinGW, so the test needs to be excluded for it too.


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/26543/c4602523686@github.com>

Javid Khan

unread,
4:29 AM (10 hours ago) 4:29 AM
to wx-...@googlegroups.com, Push

@dxbjavid pushed 1 commit.

  • 9478f55 Also exclude trailing % format test for MinGW


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/26543/before/e9c8816594e247f018fb6642fbbeec9137bf0486/after/9478f5574983ccffb9c20c6e14a33c5e372df03e@github.com>

Javid Khan

unread,
4:29 AM (10 hours ago) 4:29 AM
to wx-...@googlegroups.com, Subscribed
dxbjavid left a comment (wxWidgets/wxWidgets#26543)

Good point, MinGW links the MS CRT too. Changed the guard to !defined(_MSC_VER) && !defined(__MINGW32__) so it's skipped there as well.


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/26543/c4610466111@github.com>

Reply all
Reply to author
Forward
0 new messages