From 7fa1986b279d4915c97b44d92abc3ff6c9596ca2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 20 Feb 2017 23:48:17 +0300 Subject: [PATCH] Version 1.0.14: crash fix in text rendering. Fix a regression introduced in 8d354382a4 which caused an overflow in _parAnalysis access. We were resizing _parAnalysis array for a line width without the pending newline character while we used it for painting a line including the pending newline character. It was not a problem before, when we were trimming them from the end of the string, but it results in a buffer overflow and crashes in the lastest versions. So now we just don't include the newline in the painted string, so it has exactly the same size as _parAnalysis. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/SourceFiles/ui/text/text.cpp | 5 ++--- Telegram/build/version | 6 +++--- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index f6d4b17cc..cc7f05d0b 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="1.0.14.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 9157e0590..43896f03a 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,13,0 - PRODUCTVERSION 1,0,13,0 + FILEVERSION 1,0,14,0 + PRODUCTVERSION 1,0,14,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -52,10 +52,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "1.0.13.0" + VALUE "FileVersion", "1.0.14.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.13.0" + VALUE "ProductVersion", "1.0.14.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 8a73ec166..c8ab6a130 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,13,0 - PRODUCTVERSION 1,0,13,0 + FILEVERSION 1,0,14,0 + PRODUCTVERSION 1,0,14,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "1.0.13.0" + VALUE "FileVersion", "1.0.14.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.13.0" + VALUE "ProductVersion", "1.0.14.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index c04dc3772..e6f69927a 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 1000013; -constexpr str_const AppVersionStr = "1.0.13"; +constexpr int AppVersion = 1000014; +constexpr str_const AppVersionStr = "1.0.14"; constexpr bool AppAlphaVersion = false; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp index f43acbbe5..a13267db5 100644 --- a/Telegram/SourceFiles/ui/text/text.cpp +++ b/Telegram/SourceFiles/ui/text/text.cpp @@ -869,14 +869,13 @@ public: if (_btype == TextBlockTNewline) { if (!_lineHeight) _lineHeight = blockHeight; - ushort nextStart = _t->countBlockEnd(i, e); - if (!drawLine(nextStart, i + 1, e)) { + if (!drawLine((*i)->from(), i, e)) { return; } _y += _lineHeight; _lineHeight = 0; - _lineStart = nextStart; + _lineStart = _t->countBlockEnd(i, e); _lineStartBlock = blockIndex + 1; last_rBearing = b->f_rbearing(); diff --git a/Telegram/build/version b/Telegram/build/version index 961d39df6..177ad2e07 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 1000013 +AppVersion 1000014 AppVersionStrMajor 1.0 -AppVersionStrSmall 1.0.13 -AppVersionStr 1.0.13 +AppVersionStrSmall 1.0.14 +AppVersionStr 1.0.14 AlphaChannel 0 BetaVersion 0