sw/source/core/fields/authfld.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 85dfda49880dcc6676dcda5838da1c7b36215079
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Tue Jan 23 17:16:57 2018 +0100

    Adapt odd USHRT_MAX/4 limit in FIELD_PROP_PROP_SEQ handler
    
    The code was added with 8ff71b59a7f714835e1faa2781b34b4c5b811a84 "TextField 
and
    FieldMaster 'Bibliography' completed", but, according to private 
communication
    with Oliver, that specific values was chosen rather randomly.  Still, other
    parts of the code assume m_SortKeyArr to be indexed by sal_uInt16, so use
    SAL_MAX_UINT16 here to ensure the array is not getting to big causing 
overflow
    in those other places.
    
    Change-Id: I18ed75ed7c88b04e174a82194ae7d93a5f7f7c76
    Reviewed-on: https://gerrit.libreoffice.org/48443
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sw/source/core/fields/authfld.cxx 
b/sw/source/core/fields/authfld.cxx
index 907668df8532..35c31ecd529e 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -436,7 +436,10 @@ bool    SwAuthorityFieldType::PutValue( const Any& rAny, 
sal_uInt16 nWhichId )
             {
                 m_SortKeyArr.clear();
                 const PropertyValues* pValues = aSeq.getConstArray();
-                for(sal_Int32 i = 0; i < aSeq.getLength() && i < USHRT_MAX / 
4; i++)
+                //TODO: Limiting to the first SAL_MAX_UINT16 elements of aSeq 
so that size of
+                // m_SortKeyArr remains in range of sal_uInt16, as 
GetSortKeyCount and GetSortKey
+                // still expect m_SortKeyArr to be indexed by sal_uInt16:
+                for(sal_Int32 i = 0; i < aSeq.getLength() && i < 
SAL_MAX_UINT16; i++)
                 {
                     const PropertyValue* pValue = pValues[i].getConstArray();
                     SwTOXSortKey aSortKey;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to