summaryrefslogtreecommitdiff
path: root/sw/source/core/text/porfld.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-05-20 18:02:12 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-05-20 22:38:03 +0200
commit301278b656e76b6f42af5cf8a6f5c6c02acfffeb (patch)
treea709ae2713de538eed30c15fd981e729ed926560 /sw/source/core/text/porfld.cxx
parent6cc4750f36fb505e1d7b8d1406f170807fa55644 (diff)
sw: allow the height of a line to be larger than 65536 twips
The line height can be quite large if the line contains an as-char image. Found by temporarily changing static_cast<sal_uInt16>() in sw/ to a template function to make these conversions implicit (excluding cases where the input and output types can't convert implicitly), then asking -fsanitize=implicit-unsigned-integer-truncation -fsanitize=implicit-signed-integer-truncation to flag the problematic conversions. The first hit was in SwFlyCntPortion::SetBase() (that's where 67408 turns into 1872), then the same pattern at many other places. Change-Id: Ie12f490ed8dd5c531f11506c97598ce4f7610e2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115873 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/text/porfld.cxx')
-rwxr-xr-x[-rw-r--r--]sw/source/core/text/porfld.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 21ab8eecd351..6f576983ab55 100644..100755
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -594,10 +594,10 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf )
// Height has to be changed
if ( rInf.IsMulti() )
{
- if ( Height() < nDiff )
+ if ( static_cast<SwTwips>(Height()) < nDiff )
Height( sal_uInt16( nDiff ) );
}
- else if( Width() < nDiff )
+ else if( static_cast<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
}
return bFull;
@@ -868,7 +868,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
SetHide( true );
}
- if( Width() < nDiff )
+ if( static_cast<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
return bFull;
}
@@ -1257,7 +1257,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
Height( Height() + nMainAscent - GetAscent() );
SetAscent( nMainAscent );
}
- if( Height() < nMainAscent + nMainDescent )
+ if( static_cast<SwTwips>(Height()) < nMainAscent + nMainDescent )
Height( nMainAscent + nMainDescent );
// We calculate the x positions of the characters in both lines...