diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-04-03 11:27:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-04-03 11:27:05 +0200 |
commit | 8644d10098a10e02c426a4ae80ce179586f35089 (patch) | |
tree | f045e868157e13a409f8559e5112029940f85a17 /sal/inc | |
parent | b8c87dee815d9d20b65fe97e6f838c6937cdf6ab (diff) |
Asserting rtl::O[U]StringBuffer::operator [] preconditions
...and fixing two call-sites.
Change-Id: I8ed8cb189bd5034130b49b2f57156568e6b24716
Diffstat (limited to 'sal/inc')
-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 |