[Libreoffice-commits] core.git: vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 22 15:53:13 UTC 2019
vcl/source/fontsubset/sft.cxx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 803a6ccb774ff6dc67ca697459d6679e4bc9604f
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 22 09:24:01 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 22 17:52:23 2019 +0200
cid#1222237 try silence Untrusted value as argument
Change-Id: I9a8303cd996c91855fc624b875fbc8f1286a58b5
Reviewed-on: https://gerrit.libreoffice.org/76100
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 74fa748d0ebf..2e974a10d3c6 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -272,8 +272,13 @@ static sal_uInt32 getTableSize(TrueTypeFont const *ttf, sal_uInt32 ord)
return ttf->tlens[ord];
}
-/* Hex Formatter functions */
-static const char HexChars[] = "0123456789ABCDEF";
+static char toHex(sal_uInt8 nIndex)
+{
+ /* Hex Formatter functions */
+ static const char HexChars[] = "0123456789ABCDEF";
+ assert(nIndex < SAL_N_ELEMENTS(HexChars));
+ return HexChars[nIndex];
+}
static HexFmt *HexFmtNew(FILE *outf)
{
@@ -324,8 +329,8 @@ static void HexFmtBlockWrite(HexFmt *_this, const void *ptr, sal_uInt32 size)
}
for (i=0; i<size; i++) {
Ch = static_cast<sal_uInt8 const *>(ptr)[i];
- _this->buffer[_this->bufpos++] = HexChars[Ch >> 4];
- _this->buffer[_this->bufpos++] = HexChars[Ch & 0xF];
+ _this->buffer[_this->bufpos++] = toHex(Ch >> 4);
+ _this->buffer[_this->bufpos++] = toHex(Ch & 0xF);
if (_this->bufpos == HFORMAT_LINELEN) {
HexFmtFlush(_this);
fputc('\n', _this->o);
More information about the Libreoffice-commits
mailing list