This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 673ae46eb8d0ac467e13642a7e172b7fbc13eb00
Author: Jim Jagielski <[email protected]>
AuthorDate: Mon Nov 16 07:52:29 2026 -0500

    sc: stop an ODF $$ name reference from writing past the symbol buffer
    
    A reference name of 1022 characters followed by $$ skipped the length
    test, so loading such a formula wrote past the buffer and crashed.
---
 main/sc/source/core/tool/compiler.cxx | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/main/sc/source/core/tool/compiler.cxx 
b/main/sc/source/core/tool/compiler.cxx
index 36ab8bcb57..5dd6327b8e 100644
--- a/main/sc/source/core/tool/compiler.cxx
+++ b/main/sc/source/core/tool/compiler.cxx
@@ -2344,8 +2344,17 @@ Label_MaskStateMachine:
                                 // invalid later.
                                 if (eState != ssSkipReference)
                                 {
-                                    *pSym++ = c;
-                                    *pSym++ = *pSrc++;
+                                    if (pSym > &cSymbol[ MAXSTRLEN-3 ])
+                                    {
+                                        // two characters would step past the 
overflow test above
+                                        SetError( errStringOverflow);
+                                        eState = ssSkipReference;
+                                    }
+                                    else
+                                    {
+                                        *pSym++ = c;
+                                        *pSym++ = *pSrc++;
+                                    }
                                 }
                                 bAddToSymbol = false;
                             }

Reply via email to