summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-07-23 19:55:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-07-23 20:16:50 +0100
commitf7c4e8cbf840193acb7c188163f51c8a3a14e083 (patch)
tree8597aebb5e303ac9198e7261ef6dc516ba85d8c4 /sw
parent1d663165fc35ce41610e9a73e168ac2adc0153e2 (diff)
coverity#1415614 Out-of-bounds read
Change-Id: I73d18dd6613be063002878fb4906a49863707856
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index d94d336d44a1..685555675402 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1380,18 +1380,16 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
pDeriveFormat = m_rDoc.GetDfltCharFormat();
pWhichRange = aCharFormatSetRange;
- // Fault: unknown Format, but a CharFormat
- // -> return the first one
- if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END )
+ if (nId >= RES_POOLCHR_HTML_BEGIN && nId < RES_POOLCHR_HTML_END)
+ pRCId = STR_POOLCHR_HTML_ARY[nId - RES_POOLCHR_HTML_BEGIN];
+ else if (nId >= RES_POOLCHR_NORMAL_BEGIN && nId < RES_POOLCHR_NORMAL_END)
+ pRCId = STR_POOLCHR_ARY[nId - RES_POOLCHR_BEGIN];
+ else
{
+ // Fault: unknown Format, but a CharFormat -> return the first one
OSL_ENSURE( false, "invalid Id" );
- nId = RES_POOLCHR_BEGIN;
+ pRCId = STR_POOLCHR_ARY[0];
}
-
- if (nId > RES_POOLCHR_NORMAL_END)
- pRCId = STR_POOLCHR_HTML_ARY[nId - RES_POOLCHR_HTML_BEGIN];
- else
- pRCId = STR_POOLCHR_ARY[nId - RES_POOLCHR_BEGIN];
}
break;
case POOLGRP_FRAMEFMT: