sc/source/core/tool/address.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 96f97eb05fc32654db4ba836c794b74d502b166d
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Tue Oct 26 21:57:24 2021 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Tue Oct 26 23:58:27 2021 +0200

    Heuristic filename extension should be <= 4 characters
    
    Still unclear what exact scenario in lcl_ScAddress_Parse_OOo() it
    would positively detect, but loading broken references may be
    caught by this and just a '.' dot somewhere leading to an
    (unresolved) external and then the InfoBar triggering. At least
    restrict that to the maximum length of 4 characters for common
    filename extensions.
    
    Hit by loading a range name pointing to
    $'zens. politik hj 1'.$#ref!#REF!
    or
    $'zens. politik hj 1'.$a$#ref!:#REF!
    in
    
https://ask.libreoffice.org/uploads/short-url/6jOXRPprzGPOc5y0eHkUT6y6MfB.ods
    of
    https://ask.libreoffice.org/t/69315/15
    
    Change-Id: I2191f4511cc492679259e74edd242bfced03b0fc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124240
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index b43c9bdfe6f0..ae4d48787fe3 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1234,7 +1234,8 @@ static ScRefFlags lcl_ScAddress_Parse_OOo( const 
sal_Unicode* p, const ScDocumen
                 // Specified table name is not found in this document.  Assume 
this is an external document.
                 aDocName = aTab;
                 sal_Int32 n = aDocName.lastIndexOf('.');
-                if (n > 0)
+                // Assume that common filename extensions are not more than 4 
characters.
+                if (n > 0 && aTab.getLength() - n <= 4)
                 {
                     // Extension found.  Strip it.
                     aTab = aTab.copy(0, n);

Reply via email to