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.
This commit is contained in:
John Preston 2017-02-20 23:48:17 +03:00
parent f7448bbc7f
commit 7fa1986b27
6 changed files with 16 additions and 17 deletions

View file

@ -9,7 +9,7 @@
<Identity Name="TelegramDesktop" <Identity Name="TelegramDesktop"
ProcessorArchitecture="x64" ProcessorArchitecture="x64"
Publisher="CN=Telegram Messenger LLP, O=Telegram Messenger LLP, L=London, C=GB" Publisher="CN=Telegram Messenger LLP, O=Telegram Messenger LLP, L=London, C=GB"
Version="1.0.13.0" /> Version="1.0.14.0" />
<Properties> <Properties>
<DisplayName>Telegram Desktop</DisplayName> <DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName> <PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View file

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,13,0 FILEVERSION 1,0,14,0
PRODUCTVERSION 1,0,13,0 PRODUCTVERSION 1,0,14,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -52,10 +52,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Desktop" VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "1.0.13.0" VALUE "FileVersion", "1.0.14.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "LegalCopyright", "Copyright (C) 2014-2017"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "1.0.13.0" VALUE "ProductVersion", "1.0.14.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,13,0 FILEVERSION 1,0,14,0
PRODUCTVERSION 1,0,13,0 PRODUCTVERSION 1,0,14,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Desktop Updater" VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "1.0.13.0" VALUE "FileVersion", "1.0.14.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "LegalCopyright", "Copyright (C) 2014-2017"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "1.0.13.0" VALUE "ProductVersion", "1.0.14.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL) #define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 1000013; constexpr int AppVersion = 1000014;
constexpr str_const AppVersionStr = "1.0.13"; constexpr str_const AppVersionStr = "1.0.14";
constexpr bool AppAlphaVersion = false; constexpr bool AppAlphaVersion = false;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View file

@ -869,14 +869,13 @@ public:
if (_btype == TextBlockTNewline) { if (_btype == TextBlockTNewline) {
if (!_lineHeight) _lineHeight = blockHeight; if (!_lineHeight) _lineHeight = blockHeight;
ushort nextStart = _t->countBlockEnd(i, e); if (!drawLine((*i)->from(), i, e)) {
if (!drawLine(nextStart, i + 1, e)) {
return; return;
} }
_y += _lineHeight; _y += _lineHeight;
_lineHeight = 0; _lineHeight = 0;
_lineStart = nextStart; _lineStart = _t->countBlockEnd(i, e);
_lineStartBlock = blockIndex + 1; _lineStartBlock = blockIndex + 1;
last_rBearing = b->f_rbearing(); last_rBearing = b->f_rbearing();

View file

@ -1,6 +1,6 @@
AppVersion 1000013 AppVersion 1000014
AppVersionStrMajor 1.0 AppVersionStrMajor 1.0
AppVersionStrSmall 1.0.13 AppVersionStrSmall 1.0.14
AppVersionStr 1.0.13 AppVersionStr 1.0.14
AlphaChannel 0 AlphaChannel 0
BetaVersion 0 BetaVersion 0