diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-06-23 22:36:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-06-24 07:56:34 +0200 |
commit | ab627d300d0346d1f55b15687b56bdd8df3e2116 (patch) | |
tree | 490a4f93013af0a3067cf034095a30aa224ce3d3 /canvas/Library_oglcanvas.mk | |
parent | a7c9101b1a932c0d481dd3d39108a26548895be6 (diff) |
Let rtl_[u]stringbuffer_insert throw std::bad_alloc on overflow
Prior to a95c585433246813096e8890b7ed6ef4fe30c621 "Pump XInputStream into an
SvMemoryStream rather than an OStringBuffer", this change would have caused
> $ truncate -s 3G test.xml
> $ instdir/program/soffice test.xml
to open an effectively empty draw document (after apparently catching the
std::bad_alloc now thrown from within OrcusFormatDetect::detect; see that
commit's commit message for details) rather than crashing. This works because
rtl_[u]stringbuffer_insert happen not to be decorated with SAL_THROW_EXTERN_C().
But even if they were (or when they are called from an external C program), it
wouldn't be worse to let the process terminate due to the unexpected C++
std::bad_alloc exception than to let it crash due to an overflown signed integer
computation and out-of-bounds memory write.
Change-Id: I21e353367e2b978e8893a2886ac875367a75abd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136352
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'canvas/Library_oglcanvas.mk')
0 files changed, 0 insertions, 0 deletions