chart2/source/tools/InternalData.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 82047d042e9d5d24b334eba63fd7e4c5bbbb022e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Oct 31 15:10:28 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Oct 31 21:07:55 2021 +0100

    crashtesting: assert on conversion of fdo67521-1.odg to pdf
    
     #4  0x00007fffcb03c5d9 in std::__replacement_assert(char const*, int, char 
const*, char const*)
         (__file=0x7fffcb4fbb03 
"/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/valarray",
 __line=586, __function=0x7fffcb4fbd8c "const _Tp 
&std::valarray<double>::operator[](std::size_t) const [_Tp = double]", 
__condition=0x7fffcb4fbb95 "__i < this->size()")
         at 
/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/x86_64-redhat-linux/bits/c++config.h:2660
     #5  0x00007fffcb3b4b54 in std::valarray<double>::operator[](unsigned long) 
const (this=0x7ffffffefea8, __i=0)
         at 
/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/valarray:586
     #6  0x00007fffcb3b4a79 in std::begin<double>(std::valarray<double> const&) 
(__va=...) at 
/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/valarray:1225
     #7  0x00007fffcb3b49ac in comphelper::containerToSequence<double, 
std::valarray<double> >(std::valarray<double> const&) (i_Container=...) at 
include/comphelper/sequence.hxx:192
     #8  0x00007fffcb3b4963 in 
comphelper::containerToSequence<std::valarray<double> >(std::valarray<double> 
const&) (i_Container=...) at include/comphelper/sequence.hxx:200
     #9  0x00007fffcb3aaa83 in chart::(anonymous 
namespace)::lcl_ValarrayToSequence<double>(std::valarray<double> const&) 
(rValarray=...) at chart2/source/tools/InternalData.cxx:72
    
    where begin() is implemented with return std::__addressof(__va[0]) and
    that operator[] (for arg __i) then has __glibcxx_requires_subscript(__i)
    which asserts if there is no index __i which is the case for 0 when
    the valarray is empty
    
    Change-Id: Idc2c185cbfb3806764c3071ecee302dc823b4660
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124529
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/chart2/source/tools/InternalData.cxx 
b/chart2/source/tools/InternalData.cxx
index 3249231a6fec..2cd8d309d6cd 100644
--- a/chart2/source/tools/InternalData.cxx
+++ b/chart2/source/tools/InternalData.cxx
@@ -69,6 +69,9 @@ private:
 template< typename T >
     Sequence< T > lcl_ValarrayToSequence( const std::valarray< T > & rValarray 
)
 {
+    if (!size(rValarray))
+        return Sequence<T>();
+
     return comphelper::containerToSequence(rValarray);
 }
 

Reply via email to