Kaydet (Commit) ab6d3b37 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove presumably dead < USHRT_MAX checks

The original code of 84a3db80 "initial import"
read

+        long nBoxOffset = lcl_GetLongBoxNum( sGetName ) + nSttBox;
+        long nLineOffset = lcl_GetLongBoxNum( sGetName ) + nSttLine;
+
+        if( nBoxOffset < 0 || nBoxOffset >= USHRT_MAX ||
+            nLineOffset < 0 || nLineOffset >= USHRT_MAX )
+            return 0;
+
+        if( nLineOffset >= long(pLines->Count()) )
+            return 0;
+
+        pLine = (*pLines)[ USHORT(nLineOffset) ];
+
+        // dann suche die Box
+        pBoxes = &pLine->GetTabBoxes();
+        if( nBoxOffset >= long(pBoxes->Count()) )
+            return 0;
+        pBox = (*pBoxes)[ USHORT(nBoxOffset) ];

casting nBox/LineOffset to USHORT, while the current code looks like it should
work fine for larger values.

Change-Id: I47bdf3963be6e84568a589711ce688b66f325db8
Reviewed-on: https://gerrit.libreoffice.org/48451Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst e0e19de6
...@@ -782,8 +782,8 @@ static const SwTableBox* lcl_RelToBox( const SwTable& rTable, ...@@ -782,8 +782,8 @@ static const SwTableBox* lcl_RelToBox( const SwTable& rTable,
const sal_Int32 nBoxOffset = lcl_GetLongBoxNum( sGetName ) + nSttBox; const sal_Int32 nBoxOffset = lcl_GetLongBoxNum( sGetName ) + nSttBox;
const sal_Int32 nLineOffset = lcl_GetLongBoxNum( sGetName ) + nSttLine; const sal_Int32 nLineOffset = lcl_GetLongBoxNum( sGetName ) + nSttLine;
if( nBoxOffset < 0 || nBoxOffset >= USHRT_MAX || if( nBoxOffset < 0 ||
nLineOffset < 0 || nLineOffset >= USHRT_MAX ) nLineOffset < 0 )
return nullptr; return nullptr;
if( static_cast<size_t>(nLineOffset) >= pLines->size() ) if( static_cast<size_t>(nLineOffset) >= pLines->size() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment