diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2016-02-18 13:20:24 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2016-02-26 08:41:39 +0000 |
commit | c320d5221f166d3657771ae55585cba051f8caef (patch) | |
tree | 36846fe27e53166ae455dd893bdbe5d5e2504a2c | |
parent | 4905bf06549ce33250b13e837d192e92bffffcdb (diff) |
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 <marc.mutz@kdab.com>
-rw-r--r-- | src/corelib/global/qlogging.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |