Fix rtl string qa NULL-deref crashes (test bug + source hardening) (#486)* Fix rtl string qa NULL-deref crashes (test bug + source hardening)Error case 1 of the test migration: ~40 *_000 cases in
Fix rtl string qa NULL-deref crashes (test bug + source hardening) (#486)* Fix rtl string qa NULL-deref crashes (test bug + source hardening)Error case 1 of the test migration: ~40 *_000 cases in the rtl stringqa suites passed NULL into C string functions that dereference it(e.g. rtl_str_compare(NULL, NULL)), causing 0xC0000005 AVs. These weredormant under the old dmake build and only surface now that the testsactually run. NULL violates the functions' documented contract("must be null-terminated"), so the defect was in the tests, not the(correct, unchanged) source. Fixed both sides for defense in depth.Tests (qa/rtl/ostring/rtl_str.cxx, rtl_string.cxx,qa/rtl/oustring/rtl_ustr.cxx):- Rewrote the UB NULL-deref cases as contract-respecting boundary tests (empty string, prefix/ordering-sign < 0 / > 0), which also closes a previously-untested coverage gap (result sign was never asserted).- Added real assertions to the safe NULL-with-length-0 cases, which document the length-bounded functions' tolerance as a regression guard.Source (rtl/source/strtmpl.c, ustring.c):- Added entry-point NULL guards: OSL_PRECOND (diagnoses misuse loudly in non-product builds, compiles out in product builds) plus a defined empty-string fallback so the library never dereferences NULL. Guards sit at function entry, outside the per-character loops, so string-processing throughput is unchanged.- strtmpl.c: one edit covers both the sal_Char and sal_Unicode instantiations. getLength is the choke point (guarding it transitively protects hashCode, lastIndexOf*, indexOfStr, trim); compare/compareIgnoreAsciiCase/indexOfChar/replaceChar/ toAscii{Lower,Upper}Case/valueOfChar guarded directly.- ustring.c: guarded the 6 mixed UTF-16/ASCII comparison helpers; length-bounded args clamp the length to 0 to avoid NULL+0 pointer arithmetic.BUILD.bazel: rtl_str/rtl_ustr/rtl_string removed from the"known upstream failures" notes; they now pass.Verified: sal3.dll rebuilds (both template instantiations) andrtl_str / rtl_ustr / rtl_string all pass.Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>* use guards only in debug mode.* improved comment by elaborate that it has been the former test and not just The former---------Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
show more ...
misc: fix spelling (#459)* misc: fix spelling* Regenerate ignored words list codespell.txt
pre-commit auto remove trailing whitespace from cxx files (#383)Another big auto clean up. So many lines !!Another one bites the dusthttps://www.youtube.com/watch?v=rY0WxgSXdEECo-authored-by:
pre-commit auto remove trailing whitespace from cxx files (#383)Another big auto clean up. So many lines !!Another one bites the dusthttps://www.youtube.com/watch?v=rY0WxgSXdEECo-authored-by: Matthias Seidel <mseidel@apache.org>
pre-commit auto remove trailing whitespace from `.mk` files (#377)If there are too many changes / files I can create a smaller PRThanks
pre-commit(end-of-file-fixer): auto fix `.mk` files (#266)* pre-commit(end-of-file-fixer): auto fix `.mk` files* Update makefile.mk* Update makefile.mk---------Co-authored-by: Matthias Seid
pre-commit(end-of-file-fixer): auto fix `.mk` files (#266)* pre-commit(end-of-file-fixer): auto fix `.mk` files* Update makefile.mk* Update makefile.mk---------Co-authored-by: Matthias Seidel <mseidel@apache.org>
#i125003# migrate main/sal/qa/rtl/oustring from cppunit to Google Test.git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1700704 13f79535-47bb-0310-9956-ffa450edef68
Update headers to Alv2 headersgit-svn-id: https://svn.apache.org/repos/asf/incubator/ooo/trunk@1307668 13f79535-47bb-0310-9956-ffa450edef68
Update headers to Alv2 headersgit-svn-id: https://svn.apache.org/repos/asf/incubator/ooo/trunk@1306682 13f79535-47bb-0310-9956-ffa450edef68
Update headers to Alv2 headersgit-svn-id: https://svn.apache.org/repos/asf/incubator/ooo/trunk@1229815 13f79535-47bb-0310-9956-ffa450edef68
Update headers to Alv2 headersgit-svn-id: https://svn.apache.org/repos/asf/incubator/ooo/trunk@1198277 13f79535-47bb-0310-9956-ffa450edef68
Initial import of the old OOo hg repository tip revision. .../trunk/main is a copy of (currently tip-most) http://hg.services.openoffice.org/OOO340/rev/c904c1944462 .../trunk/extras/l10n is a co
Initial import of the old OOo hg repository tip revision. .../trunk/main is a copy of (currently tip-most) http://hg.services.openoffice.org/OOO340/rev/c904c1944462 .../trunk/extras/l10n is a copy of (currently tip-most) http://hg.services.openoffice.org/master_l10n/OOO340/rev/af6bc9467af5 Note that the following files with line-end and/or encoding anomalies were left out (they will need to be to be checked in separately):/ooo/trunk/core/dictionaries/de_DE/README_hyph_de_DE.txt/ooo/trunk/core/dictionaries/de_CH/README_hyph_de_CH.txt/ooo/trunk/core/dictionaries/de_AT/README_hyph_de_AT.txt/ooo/trunk/core/gettext/gettext-0.18.1.1.patch/ooo/trunk/core/apache-commons/patches/codec.patch/ooo/trunk/core/libcroco/libcroco-0.6.2.patch/ooo/trunk/core/testautomation/writer/optional/input/import/mactext.txt/ooo/trunk/core/graphite/graphite-2.3.1.patch/ooo/trunk/core/hwpfilter/source/hwpeq.cpp/ooo/trunk/core/solenv/bin/cwstouched.pl/ooo/trunk/core/readlicense_oo/html/THIRDPARTYLICENSEREADME.html/ooo/trunk/core/writerfilter/source/doctok/escher.html/ooo/trunk/core/writerfilter/source/odiapi/qname/resource/office2003/WordprocessingML Schemas/xsdlib.xsd/ooo/trunk/core/writerfilter/source/odiapi/qname/resource/office2003/WordprocessingML Schemas/wordnetaux.xsd/ooo/trunk/core/filter/source/xslt/odf2xhtml/export/common/body.xsl/ooo/trunk/core/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xslAlso: Repository.mk from the l10n toplevelgit-svn-id: https://svn.apache.org/repos/asf/incubator/ooo/trunk@1162288 13f79535-47bb-0310-9956-ffa450edef68