oox/source/export/drawingml.cxx |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit d78b115d48156b2fd91216877f3525722683f1bb
Author:     Justin Luth <[email protected]>
AuthorDate: Fri Jan 30 18:31:08 2026 -0500
Commit:     Justin Luth <[email protected]>
CommitDate: Sat Jan 31 02:51:04 2026 +0100

    tdf#166335 followup: remove assert - gluePoint indexes are ~random
    
    I spent 6.5 hours trying to 'find something wrong'.
    Well, apart from 'everything', I didn't find anything
    that was comprehensible and clearly wrong.
    
    So I'll just document that yet another piece of this puzzle
    is completely unreliable.
    
    Change-Id: I53891f73d446264287600f03199b5262b7428d11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198441
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <[email protected]>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index aa1ea00bb173..ffa00ec9fef7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -5049,8 +5049,14 @@ void prepareGluePoints(std::vector<Guide>& rGuideList,
             if (rGluePoint.First.Value >>= nIdx1)
             {
                 bValidIdx1 = rGluePoint.First.Type == 
EnhancedCustomShapeParameterType::EQUATION;
-                // I would assume that any EQUATION must define a valid index 
value.
-                assert(!bValidIdx1 || (nIdx1 >= 0 && nIdx1 < 
aEquations.getLength()));
+                assert(!bValidIdx1 || nIdx1 >= 0); // It is always an index at 
least
+                // tdf#166335
+                // Sadly, these equation indexes  point to a 
(changed/enlarged) parsed collection,
+                // but aEquations is the un-parsed collection.
+                // For larger values, there is a good chance that the wrong 
equation is used.
+                // However, this is so complicated that we ignore that,
+                // and simply make sure we don't export corruption. Inaccuracy 
is fine...
+                bValidIdx1 = bValidIdx1 && nIdx1 < aEquations.getLength();
             }
             else
                 continue;
@@ -5058,7 +5064,8 @@ void prepareGluePoints(std::vector<Guide>& rGuideList,
             if (rGluePoint.Second.Value >>= nIdx2)
             {
                 bValidIdx2 = rGluePoint.Second.Type == 
EnhancedCustomShapeParameterType::EQUATION;
-                assert(!bValidIdx2 || (nIdx2 >= 0 && nIdx2 < 
aEquations.getLength()));
+                assert(!bValidIdx2 || nIdx2 >= 0);
+                bValidIdx2 = bValidIdx2 && nIdx2 < aEquations.getLength();
             }
             else
                 continue;

Reply via email to