diff options
Diffstat (limited to 'sal/inc/rtl')
-rw-r--r-- | sal/inc/rtl/strbuf.hxx | 6 | ||||
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx index 4dabc7653e7b..d858c89023da 100644 --- a/sal/inc/rtl/strbuf.hxx +++ b/sal/inc/rtl/strbuf.hxx @@ -417,7 +417,11 @@ public: @since LibreOffice 3.5 */ - sal_Char & operator [](sal_Int32 index) { return pData->buffer[index]; } + sal_Char & operator [](sal_Int32 index) + { + assert(index >= 0 && index < pData->length); + return pData->buffer[index]; + } /** Return a OString instance reflecting the current content diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index 95993fc4a12c..abbf3d01ade5 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -409,7 +409,11 @@ public: @since LibreOffice 3.5 */ - sal_Unicode & operator [](sal_Int32 index) { return pData->buffer[index]; } + sal_Unicode & operator [](sal_Int32 index) + { + assert(index >= 0 && index < pData->length); + return pData->buffer[index]; + } /** Return a OUString instance reflecting the current content |