From c320d5221f166d3657771ae55585cba051f8caef Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 18 Feb 2016 13:20:24 +0100 Subject: Win: Prevent crash in qt_message_fatal() The source argument can be nullptr, e.g. if debug information has been stripped out. Task-number: QTBUG-51195 Change-Id: Ie229c82278c420200cad33c19e8c3f52ab7f12c3 Reviewed-by: Marc Mutz --- src/corelib/global/qlogging.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 20c31f7ef8..e629e16e8d 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -250,10 +250,11 @@ static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const cha if (len + 1 > space) { const size_t skip = len - space + 4; // 4 for "..." + '\0' s += skip; + len -= skip; for (int i = 0; i < 3; ++i) *d++ = L'.'; } - while (*s) + while (len--) *d++ = *s++; *d++ = 0; } -- cgit v1.2.3