summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-10-26 21:57:24 +0200
committerEike Rathke <erack@redhat.com>2021-10-26 23:58:27 +0200
commit96f97eb05fc32654db4ba836c794b74d502b166d (patch)
tree810822ff619076de98fc9a1e3f91d52253748da7 /sc/source
parentbaa6f7737d2b009739a244afd641eee35425015e (diff)
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 <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/tool/address.cxx3
1 files changed, 2 insertions, 1 deletions
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);