Age | Commit message (Collapse) | Author |
|
Change-Id: Ic883a07b30069ca6342d7521c8ad890f4326f0ec
Reviewed-on: https://gerrit.libreoffice.org/39549
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...in recently introduced basic/qa/basic_coverage/test_string_overflow_safe.vb
in CppunitTest_basic_macros
Change-Id: Ib33272afa26e90729617cb86ae979c0b35b45f62
|
|
rtl_[u]String_newConcat now checks allocation result to return
early and avoid SIGSEGV. Other functions are not modified, to
keep old behavior relying on allocation success and crashing
early on OOM to avoid added overhead in performance-critical
places.
OUString operator+= now checks rtl_uString_newConcat result and
throws std::bad_alloc on failure, to specifically address BASIC
problem. It keeps strong exception guarantee of leaving this'
state unaltered.
Concatenation in BASIC now checks for bad string allocation
(previously SIGSEGV was generated).
Unit test included.
Change-Id: I1513311d3d58eac43b2d2ec9a230e22dff0b4245
Reviewed-on: https://gerrit.libreoffice.org/37965
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
|
|
For whatever reason oox shape import code uses OUStrings that contain
'\0' characters.
The rtl_uString / rtl_String are allowed to contain '\0' but the
strncmp/wcsncmp functions stop comparing on the first '\0', so use
memcmp/wmemcmp instead.
(regression from 281989007fd7dea997ed9a65f513f80b1aff67dd)
Change-Id: If148927f19d065a21f32f3c14433b0bda7ae9301
Reviewed-on: https://gerrit.libreoffice.org/29384
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
|
|
Change-Id: I6c656f991999791469015500aff1905fdb16ba65
|
|
Including no keywords from extern "C" blocks
Change-Id: I87f2ed75888b51ec9e0cb75566bf7c2351b479b4
Reviewed-on: https://gerrit.libreoffice.org/23675
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Find a few million mis-predicted branches (according to callgrind)
and annotate them. Mark string acquire/release as hot, and a number of
deprecated methods as cold.
Change-Id: I678b3981794221c97f9ebb70fd0161c0fda5dceb
|
|
Change-Id: I1bc6c87fcd6e5e96362623be94c59be216a3b2b8
|
|
...where in C++ memchr does not have exactly the two overloads
void const * memchr(void const *, int, size_t)
void * memchr(void *, int, size_t)
but rather the C
void * memchr(void const *, int, size_t)
shining through (see bugreport.apple.com issue 21128245 "non-conforming memchr
in C++"), which gets in the way of the upcoming improved redundant const_cast
check in loplugin:redundantcast.
Change-Id: I7001e74e03429ef23682d52da28fca435130d775
|
|
Change-Id: I5e370445affbcd32b05588111f74590bf24f39d6
|
|
Change-Id: I03e43d219a65aa270f73a91896e0e7a567d424bc
|
|
Change-Id: I70330b1f4844f33779f814377afaf90e0a219b1d
|
|
Change-Id: Ifc03631b126ec19cb98cb42a258ca4880e868385
|
|
Also remove some now redundant asserts from headers.
Some of these actually trigger on unit tests so are commented out.
Change-Id: I07c6b2b2bd175361691a141f22eec584e3ab8f0b
|
|
and we can include a few less headers
Change-Id: Id742849ff4c1c37a2b861aa3d6ab823f00ea87f8
|
|
Change-Id: I13058a46526a1186deaa8fffde303c272c0cc8aa
|
|
Change-Id: Ie54d340478412e62b87d66e287fd8a3963e97898
|
|
...and there is no reason for such a precond for rtl_string_newFromLiteral
Change-Id: I27f7217c8db17cef860c37886d0f7e561dc852f8
|
|
Change-Id: I9793f697f14118340bc6db89540fe50ad0b8ccbd
|
|
Change-Id: I214884e9ee1d49dcc4db71f8744513468b912691
|
|
Change-Id: I82113fcd4182f9557ba0e7258498b5d4e798bf03
|
|
Change-Id: I012027c38a6d2b06a4bb0cb53743d350b124ccf4
|
|
..handling where possible.
Change-Id: I0b071988ed266cc2745a8ca9705c106a05edc557
Reviewed-on: https://gerrit.libreoffice.org/10020
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
|
|
Change-Id: Ie2a6b5e71f76ff2900ff078fcc098e66927458ef
|
|
8f8bc0dcf3bc253ae49159d52db049767f476ced "Move string hash function into String
class" had introduced a new getHash64 that, besides returning sal_uInt64 instead
of just sal_Int32, didn't do sampling of only a handful of characters, but
always computed the hash over all characters (as the usage in SfxItemSet and
SdPage appears to require for either performance or approximated correctness).
However, it would be advantageous to keep the stable URE interface as small as
possible. Now, O(1) sampling was apparently considered state of the art when
the rtl string classes were first created, closely copying java.lang.String,
which at that time demanded sampling for hashCode(), too---but never sampling
more than 15 characters, with the obvious (in hindsight, at least) performance
catastrophes, so they changed it to O(n) somewhere along the way.
Based on that, this commit changes the existing hash functions to not do
sampling any more, and removes the newly introduced -64 variants again. (Where
the extended value range of sal_uInt64 compared to sal_Int32 was hopefully not
vital to the existing uses.)
The old implementation used sampling only for strings of length >= 256, so I did
a "make check" build with an instrumented hash function that flagged all uses
with inputs of length >= 256, and grepped workdir/{Cppunit,Junit,Python}Test for
hits. Of the 2849 hits encountered, 2845 where in the range from 256 to 295
characters, and only the remaining four where of 2472 characters. Those four
were from CppunitTest_sc_subsequent_filters_test, importing long text into a
cell, causing ScDocumentImport::setStringCell to call
svl::SharedStringPool::intern, which internally uses an unordered_set. These
results appear to justify the change.
Change-Id: I78fcc3b0f07389bdf36a21701b95a1ff0a0d970f
|
|
Change-Id: I071a931660dafc1ee5950da527b042fb175255b8
|
|
hashCode() seems to do sampling while creating the hash.
hashCode64() will not.
Change-Id: Id30f5a2a774cf5244dbc00da9649e95a532484be
|
|
Change-Id: I266d5cf5b98827617f7ed65c94a772e28808f386
|
|
It is probably best to base the functions on Unicode code points instead of
scalar values, now that they are also used from sal/rtl/strtmpl.cxx with UTF-16
code units and with arbitrary bytes (with values assumed to be a superset of
ASCII, though). Rename compareAsciiIgnoreCase to compareIgnoreAsciiCase. Also,
the corresponding tools::INetMIME functions can be removed completely; no need
to keep them around as deprecated.
Change-Id: I8d322177f4909e70a946e8186e3e0f7fa6d9a43e
|
|
Also remove all others implementations.
Change-Id: I1dc108a9103f087bd8ce591dff2ac5dd254746f8
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
|
|
as flagged by Clang -fsanitize=undefined
Change-Id: Iff1aa4473d960009890b923fba734257ecd8b3ef
|
|
...as its assert requires that both input characters are ASCII, which need not
be the case in these compareIgnoreAsciiCase functions. (Even if they take one
literal argument that must be strictly ASCII, the other argument can be an
arbitrary Unicode string in the case of OUString or an arbitrary 8-bit string in
the case of OString).
The logically correct version of rtl::compareAsciiIgnoreCase would arguably be
one that requires its two arguments to be valid UTF-32 code units, but that
could not be used in these places either, as for OUString they operate on
individual UTF-16 code units.
rtl::compareAsciiIgnoreCase likely makes less sense after all than assumed in
c8e39e66528affb66f1ae121fa36dd4ab31a9b0b "Introduce rtl::compareIgnoreCase and
deprecate rtl/character.hxx equivalents," which this commit partly reverts.
Change-Id: Ib2eed3a1896e83d9c66b0479a03f9ec51e1c4dc0
|
|
Change-Id: Id90935fd2b0f904f89477792edc8140cfc31e91f
Reviewed-on: https://gerrit.libreoffice.org/5412
Reviewed-by: Petr Mladek <pmladek@suse.cz>
Tested-by: Petr Mladek <pmladek@suse.cz>
|
|
...which has become necessary since bd60d41176da540b01d7583cfe00637431967f39
"Handle oveflow in O(U)String::toInt() functions" reduces values in the range
(SAL_MAX_INT32 .. SAL_MAX_UINT32] to zero, but some calls of toInt32(16) relied
on getting a correct (unsigned) value for the whole input range ["0" ..
"FFFFFFFF"] (see libreoffice-4-1 commit 9bf6c83367cedb7be81bf67f30d2147d26c7a8c3
"Revert overflow checks in O[U]String::toInt{32,64} again").
Audited all uses of toInt32/64 with non-decimal radix. (There is still a TODO
comment in oox/source/helper/attributelist.cxx, and
stoc/source/typeconv/convert.cxx will still need some love and test code.)
Change-Id: Iadaca1c0e41dab553687d0ce41c20c10cd657a95
|
|
Change-Id: I43262c984c311fcb1e1a9eca9b4dec4092351dea
|
|
...for negative integers in < C++11? Rather unlikely, but lets see...
Change-Id: I9abfcbf2c0e409fab4c77b62e5f734d3c2cc2719
|
|
Return 0 when overflow.
The base idea in unsigned case is checking wheather
(Max-nDigit)/nRadix < n
But for efficency, take out nDiv = Max/nRadix from loop
and corrigate it with -1 if needed.
In signed case use minimum value if the number is negativ.
Change-Id: I5b77580adbf12421b6c4b785ba9bc2a080accba2
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: Iaefddeb816d36d4a07234d903fafab3d6b83e1d2
Reviewed-on: https://gerrit.libreoffice.org/2952
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Reviewed-by: Thorsten Behrens <tbehrens@suse.com>
Tested-by: Thorsten Behrens <tbehrens@suse.com>
|
|
Change-Id: I03de46fb6c095bb176fd25fc5f803be6d2d89bcf
|