ofz#47463 OOM only first byte of 'font', 'ratio' and 'space' are used
1.098GB -> 854.6MB Change-Id: I3390c3a5abe457f8d0ad49b03b50a2d353566c2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136142 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
f4ff0ed557
commit
43ae4e9a69
4 changed files with 25 additions and 18 deletions
|
@ -261,10 +261,10 @@ void ParaShape::Read(HWPFile & hwpf)
|
|||
CharShape::CharShape()
|
||||
: index(0)
|
||||
, size(0)
|
||||
, font{0}
|
||||
, ratio{0}
|
||||
, space{0}
|
||||
, color{0}
|
||||
, font(0)
|
||||
, space(0)
|
||||
, ratio(0)
|
||||
, shade(0)
|
||||
, attr(0)
|
||||
{
|
||||
|
@ -276,9 +276,16 @@ void CharShape::Read(HWPFile & hwpf)
|
|||
if (!hwpf.Read2b(tmp16))
|
||||
return;
|
||||
size = tmp16;
|
||||
hwpf.ReadBlock(font, NLanguage);
|
||||
hwpf.ReadBlock(ratio, NLanguage);
|
||||
hwpf.ReadBlock(space, NLanguage);
|
||||
|
||||
hwpf.Read1b(font);
|
||||
hwpf.SkipBlock(NLanguage - 1); //skip unused part of remaining font field
|
||||
|
||||
hwpf.Read1b(ratio);
|
||||
hwpf.SkipBlock(NLanguage - 1); //skip unused part of remaining ratio field
|
||||
|
||||
hwpf.Read1b(space);
|
||||
hwpf.SkipBlock(NLanguage - 1); //skip unused part of remaining space field
|
||||
|
||||
hwpf.ReadBlock(color, 2);
|
||||
hwpf.Read1b(shade);
|
||||
hwpf.Read1b(attr);
|
||||
|
|
|
@ -219,10 +219,10 @@ struct CharShape
|
|||
* Font size
|
||||
*/
|
||||
hunit size;
|
||||
unsigned char font[NLanguage];
|
||||
unsigned char ratio[NLanguage];
|
||||
signed char space[NLanguage]; /* 자간 */
|
||||
unsigned char color[2];
|
||||
unsigned char font;
|
||||
char space; /* 자간 */
|
||||
unsigned char ratio;
|
||||
unsigned char shade;
|
||||
unsigned char attr;
|
||||
|
||||
|
|
|
@ -603,9 +603,9 @@ int HWPFile::compareCharShape(CharShape const *shape)
|
|||
CharShape *cshape = getCharShape(i);
|
||||
|
||||
if( shape->size == cshape->size &&
|
||||
shape->font[0] == cshape->font[0] &&
|
||||
shape->ratio[0] == cshape->ratio[0] &&
|
||||
shape->space[0] == cshape->space[0] &&
|
||||
shape->font == cshape->font &&
|
||||
shape->ratio == cshape->ratio &&
|
||||
shape->space == cshape->space &&
|
||||
shape->color[1] == cshape->color[1] &&
|
||||
shape->color[0] == cshape->color[0] &&
|
||||
shape->shade == cshape->shade &&
|
||||
|
@ -639,9 +639,9 @@ int HWPFile::compareParaShape(const ParaShape* shape)
|
|||
shape->pagebreak == pshape->pagebreak)
|
||||
{
|
||||
if (shape->cshape->size == pshape->cshape->size &&
|
||||
shape->cshape->font[0] == pshape->cshape->font[0] &&
|
||||
shape->cshape->ratio[0] == pshape->cshape->ratio[0] &&
|
||||
shape->cshape->space[0] == pshape->cshape->space[0] &&
|
||||
shape->cshape->font == pshape->cshape->font &&
|
||||
shape->cshape->ratio == pshape->cshape->ratio &&
|
||||
shape->cshape->space == pshape->cshape->space &&
|
||||
shape->cshape->color[1] == pshape->cshape->color[1] &&
|
||||
shape->cshape->color[0] == pshape->cshape->color[0] &&
|
||||
shape->cshape->shade == pshape->cshape->shade &&
|
||||
|
|
|
@ -1271,7 +1271,7 @@ void HwpReader::parseCharShape(CharShape const * cshape)
|
|||
mxList->addAttribute("style:font-size-asian", sXML_CDATA, OUString::number(cshape->size / 25) + "pt");
|
||||
|
||||
::std::string const tmp = hstr2ksstr(kstr2hstr(
|
||||
reinterpret_cast<unsigned char const *>(hwpfont.GetFontName(0, cshape->font[0]))).c_str());
|
||||
reinterpret_cast<unsigned char const *>(hwpfont.GetFontName(0, cshape->font))).c_str());
|
||||
double fRatio = 1.0;
|
||||
int size = getRepFamilyName(tmp.c_str(), d->buf, fRatio);
|
||||
|
||||
|
@ -1281,9 +1281,9 @@ void HwpReader::parseCharShape(CharShape const * cshape)
|
|||
OUString(d->buf, size, RTL_TEXTENCODING_EUC_KR));
|
||||
|
||||
mxList->addAttribute("style:text-scale", sXML_CDATA,
|
||||
OUString::number(static_cast<int>(cshape->ratio[0] * fRatio)) + "%");
|
||||
OUString::number(static_cast<int>(cshape->ratio * fRatio)) + "%");
|
||||
|
||||
double sspace = (cshape->size / 25) * cshape->space[0] / 100.;
|
||||
double sspace = (cshape->size / 25) * cshape->space / 100.;
|
||||
|
||||
if (sspace != 0.)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue