summaryrefslogtreecommitdiff
path: root/sax
AgeCommit message (Collapse)AuthorFilesLines
2018-03-25ofz#7110 ensure join is called on std::exceptions as well as uno::ExceptionCaolán McNamara1-6/+6
Change-Id: I1d17301e4d7f951b7176d5a91c0dca0ef051b2a2 Reviewed-on: https://gerrit.libreoffice.org/51830 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-16crashtesting: asserts on legal xml names on exportCaolán McNamara1-4/+18
e.g. ooo82358-1.odt which has Chinese characters used in tags inside a parent xforms:instance tag Change-Id: If2edf9cc13e5a4cc969f5a46618a6534c52f2877 Reviewed-on: https://gerrit.libreoffice.org/51352 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2018-03-06add some color conversion methods to sax::ConverterNoel Grandin1-0/+1
to make the call-sites less verbose Change-Id: Ifddcbb03a454a241bef93f31a8025801b84a66fc Reviewed-on: https://gerrit.libreoffice.org/50578 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-05drop sax::tools::*base64 methodsNoel Grandin2-60/+0
and use the underlying comphelper methods rather. This is so that I can break the dependency that tools has on sax, and can add methods that make sax depend on tools. Change-Id: I8a2d6ce2ffc3529a0020710ade6a1748ee5af7d5 Reviewed-on: https://gerrit.libreoffice.org/50767 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-02tdf#115429 sax,xmloff: assert on empty attribute names & namespacesMichael Stahl1-0/+1
Surely that's indication of a bug somewhere. Change-Id: Ic6219d8eb7f22301d8c4da98b2132ae3ef0467b5 Reviewed-on: https://gerrit.libreoffice.org/50579 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-03-01tdf#115429 sax: assert if exporting an invalid XML attribute/elementMichael Stahl2-4/+41
Add a cheap check for this in both SaxWriter and FastSaxSerializer so we can find such bugs earlier, e.g. with the weekly crashtesting. Don't do a correct check but a cheap & fast one, let's ignore non-ASCII characters for now as the only filter with such is UOF and that is implemented with XSLT, not this sax code. Change-Id: I4db8f70ffb23684d4cb4211468519edd6c7c465f Reviewed-on: https://gerrit.libreoffice.org/50507 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-02-28sax: don't crash during loggingVasily Melenchuk1-1/+1
SaxParser was crashing during load of some MS documents if logging is enabled. Change-Id: I08a57b9a948bb4a35afcb82a29614c2f6a443446 Reviewed-on: https://gerrit.libreoffice.org/50110 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-02-21New loplugin:nestedunnamedStephan Bergmann1-19/+16
Change-Id: Ifb434589ef08428ce609bc7a40b015d4df13224c Reviewed-on: https://gerrit.libreoffice.org/50048 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-24Fix typosAndrea Gelmini1-1/+1
Change-Id: I359c5aff8c90359783588d189de4e5b94224fa9c Reviewed-on: https://gerrit.libreoffice.org/48232 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-24loplugin:constparamsNoel Grandin1-2/+2
Change-Id: I7c695073d9a9d3b7a641d6eb9fe01a47d8c3a504 Reviewed-on: https://gerrit.libreoffice.org/48392 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19SAL_W32 is just an alias for _WIN32Stephan Bergmann1-2/+2
...so consistently use the latter instead of the former Change-Id: I144d5e7c472632f93b2258461510346bc85892d9 Reviewed-on: https://gerrit.libreoffice.org/48135 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-16Fix typosAndrea Gelmini1-1/+1
Change-Id: Ia976371bf52eb1216d8abe728d80bbb87a3c38a2 Reviewed-on: https://gerrit.libreoffice.org/47858 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-12More loplugin:cstylecast: saxStephan Bergmann6-19/+19
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ide5941d633fb3bf930b790d644154829b77ad117
2018-01-06ofz#4392 sax: guard access to Entity::maSavedException with mutexMichael Stahl1-3/+30
The problem here is presumably that the parser thread reports a low-level SAX exception and the main thread reports a high-level filter exception at the same time, so both threads modify maSavedException concurrently. Change-Id: Ic8ce9a4992208a24a111c990a67be163858ddaf8 Reviewed-on: https://gerrit.libreoffice.org/47478 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
2018-01-05sax: remove that odd Entity copy constructorMichael Stahl1-32/+19
Change-Id: I7929ccf751d37f65975d6412e28d34bec4421c07
2018-01-04Modifying the impl. of startUnknownElement of FastParser:Mohammed Abdul Azeem2-34/+43
Modifying it to emit the namespace URI instead of prefix and qualified name instead of local name. This will be useful for handling arbitrary elements in the fast contexts. Change-Id: I0f150b862574612e97491f6c335f3f4c9966da0a Reviewed-on: https://gerrit.libreoffice.org/47055 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-12-24loplugin:passstuffbyref even more return improvementsNoel Grandin1-4/+4
Change-Id: I2a752025cd429e4d271626402dce5d8a8b0c76d2 Reviewed-on: https://gerrit.libreoffice.org/47021 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-23loplugin:passstuffbyref improved returnsNoel Grandin3-3/+3
improve the detection of stuff we can return by const &, instead of by copying Change-Id: I479ae89d0413125a8295cc3cddbc0017ed61ed69 Reviewed-on: https://gerrit.libreoffice.org/46915 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-21new loplugin: convertlongNoel Grandin1-1/+1
merge the droplong and convertuintptr into one new plugin. Limit the analysis to looking at var decl's, since that seems to be safest proposition, even if that too needs some careful analysis. Change-Id: Id005baaf05cfb157ce44a06a1c81f08559a07d1f Reviewed-on: https://gerrit.libreoffice.org/46851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-11loplugin:salcall fix functionsNoel Grandin4-4/+4
since cdecl is the default calling convention on Windows for such functions, the annotation is redundant. Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d Reviewed-on: https://gerrit.libreoffice.org/46164 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-10ofz#4571 Direct-leakCaolán McNamara1-40/+33
Change-Id: I1fbeec6a29854dbc80736ed442941f55bc1bb0a3 Reviewed-on: https://gerrit.libreoffice.org/46179 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-12-10remove unused osl/time.h includes ..Jochen Nitschke1-1/+0
and some more in base64.cxx Change-Id: I31c9f23d3bd11f5482774e976a7c40025ffcfb86 Reviewed-on: https://gerrit.libreoffice.org/46157 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-30loplugin:unnecessaryparen: signed numeric literalsStephan Bergmann1-3/+3
Change-Id: I75c8224452ca9c3711a2ccaca9ecf549fa59cb64 Reviewed-on: https://gerrit.libreoffice.org/45549 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-30ofz: always free with xmlFreeParserCtxtCaolán McNamara1-79/+77
Change-Id: I90aed11ae0a29a0e9fc725b297e10a7ed30c9942 Reviewed-on: https://gerrit.libreoffice.org/45533 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-23loplugin:simplifybool for negation of comparison operatorNoel Grandin1-1/+1
Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791 Reviewed-on: https://gerrit.libreoffice.org/45068 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-22Make loplugin:unnecessaryparen warn about (x) ? ... : ... after allStephan Bergmann2-8/+8
...which had been left out because "lots of our code uses this style, which I'm loathe to bulk-fix as yet", but now in <https://gerrit.libreoffice.org/#/c/45060/1/> "use std::unique_ptr" would have caused an otherwise innocent-looking code change to trigger a loplugin:unnecessaryparen warning for pFormat = (pGrfObj) ? ... (barring a change to ignoreAllImplicit in compilerplugins/clang/unnecessaryparen.cxx similar to that in <https://gerrit.libreoffice.org/#/c/45083/2> "Make not warning about !! in loplugin:simplifybool consistent", which should also have caused the warning to disappear for the modified code, IIUC). Change-Id: I8bff0cc11bbb839ef06d07b8d9237f150804fec2 Reviewed-on: https://gerrit.libreoffice.org/45088 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-13Fix typosAndrea Gelmini1-1/+1
Change-Id: I2a10e087a776ac96b3193226610577227d2492a8 Reviewed-on: https://gerrit.libreoffice.org/44655 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Page <aptitude@btconnect.com>
2017-11-13Fix typosAndrea Gelmini1-1/+1
Change-Id: Ia544298334364ece3b3963a4adc00c5e01189b91 Reviewed-on: https://gerrit.libreoffice.org/44654 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Page <aptitude@btconnect.com>
2017-11-03loplugin:constparam in vcl,svtoolsNoel Grandin1-2/+2
Change-Id: I7a3eb2bfda869e9e66db919f929ead60cf8890a4 Reviewed-on: https://gerrit.libreoffice.org/44209 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-31loplugin:constantparam in sal,saxNoel Grandin2-15/+10
Change-Id: I7ca2fd05d1cf61f9038c529a853e72fedb1c9ed0 Reviewed-on: https://gerrit.libreoffice.org/44087 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-26loplugin:constmethods in unotoolsNoel Grandin1-2/+2
Change-Id: I13df4e184a826682f34a1d9e974b601397ba4a3d Reviewed-on: https://gerrit.libreoffice.org/43865 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-25ofz#3752 Integer-overflowCaolán McNamara1-11/+5
Change-Id: I211327928a86f706513ebd78cff979283396e742 Reviewed-on: https://gerrit.libreoffice.org/43777 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-10-25loplugin:constmethod in tools,sax,UnoControlsNoel Grandin5-5/+5
Change-Id: Ie05e44e2a4019e2549843961ebfa04fef7b7aeb4 Reviewed-on: https://gerrit.libreoffice.org/43767 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-25ofz#3769 Integer-overflowCaolán McNamara1-8/+5
Change-Id: Ia245c6042f8c662bab870cf166db94d1cf2db9d3 Reviewed-on: https://gerrit.libreoffice.org/43781 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-10-23loplugin:includeform: saxStephan Bergmann6-9/+9
Change-Id: If54794f72502a11612e85f99713e553f91d4025e
2017-10-23overload std::hash for OUString and OStringNoel Grandin1-2/+1
no need to explicitly specify it anymore Change-Id: I6ad9259cce77201fdd75152533f5151aae83e9ec Reviewed-on: https://gerrit.libreoffice.org/43567 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-04add << operator for css::uno::ExceptionNoel Grandin1-1/+1
Change-Id: Ia23dafd07133779144965682df3b7125a3214235 Reviewed-on: https://gerrit.libreoffice.org/43046 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-09-18allow events to accumulate past limit if an exception is pendingCaolán McNamara1-1/+8
Change-Id: Ic54c31961b887e06267aba1ceb0378508d24ded0 Reviewed-on: https://gerrit.libreoffice.org/42411 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-09-17protect against short fileCaolán McNamara1-2/+1
Change-Id: I20c6a6fb34485f42c2a828618e8918d8a441860a Reviewed-on: https://gerrit.libreoffice.org/42389 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-09-17ofz: string has to be at least 5 chars longCaolán McNamara1-2/+1
Change-Id: I98c50a59c03fc886d50362b9c5dd8c84f60e0b62 Reviewed-on: https://gerrit.libreoffice.org/42379 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-09-16ofz: leak on fdo72541-1.fodtCaolán McNamara1-33/+33
Direct leak of 64 byte(s) in 2 object(s) allocated from: #0 0x600ca0 in operator new(unsigned long) /src/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:82 #1 0x86860c6 in (anonymous namespace)::Entity::getEventList() /src/libreoffice/sax/source/fastparser/fastparser.cxx:538:32 #2 0x8683e1d in (anonymous namespace)::Entity::getEvent((anonymous namespace)::CallbackType) /src/libreoffice/sax/source/fastparser/fastparser.cxx:552:29 #3 0x8684201 in sax_fastparser::FastSaxParserImpl::callbackStartElement(unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, unsigned char const**) /src/libreoffice/sax/source/fastparser/fastparser.cxx:1071:29 #4 0x8683cfb in (anonymous namespace)::call_callbackStartElement(void*, unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, int, unsigned char const**) /src/libreoffice/sax/source/fastparser/fastparser.cxx:306:18 #5 0x5d178b6 in xmlParseStartTag2 (/out/fodtfuzzer+0x5d178b6) #6 0x5d1b979 in xmlParseTryOrFinish (/out/fodtfuzzer+0x5d1b979) #7 0x5d1ac9d in xmlParseChunk (/out/fodtfuzzer+0x5d1ac9d) #8 0x8682d9e in sax_fastparser::FastSaxParserImpl::parse() /src/libreoffice/sax/source/fastparser/fastparser.cxx:1040:25 #9 0x868a537 in (anonymous namespace)::ParserThread::execute() /src/libreoffice/sax/source/fastparser/fastparser.cxx:289:23 #10 0x514e7be in salhelper::Thread::run() /src/libreoffice/salhelper/source/thread.cxx:40:9 #11 0x1931a41 in threadFunc /src/libreoffice/include/osl/thread.hxx:185:15 #12 0x51d47a1 in osl_thread_start_Impl(void*) /src/libreoffice/sal/osl/unx/thread.cxx:237:9 #13 0x7fdeb7b396b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9) Change-Id: Ie0a04d4b887e3bb764e8fa80212dc5d5b3965aca Reviewed-on: https://gerrit.libreoffice.org/42355 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-09-13New rtl::isUnicodeScalarValue, rtl::isSurrogateStephan Bergmann1-2/+2
There are apparently various places that want to check for a Unicode scalar value rather than for a Unicode code point. Changed those uses of rtl::isUnicodeCodePoint where that was obvious. (For changing svtools/source/svrtf/svparser.cxx see 8e0fb74dc01927b60d8b868548ef8fe1d7a80ce3 "Revert 'svtools: HTML import: don't put lone surrogates in OUString'".) Other uses of rtl::isUnicodeCodePoint might also want to use rtl::isUnicodeScalarValue instead. As a side effect, this change also introduces rtl::isSurrogate, which is useful in a few places as well. Change-Id: I9245f4f98b83877145a4d392f0ddb7c5d824a535
2017-09-13sax: allow some debug logging in FastParserMichael Stahl2-1/+8
Multi-threading makes this difficult; have it print synchronously where it is in the input when setting: SAL_LOG="+INFO.sax.fastparser+WARN" SAX_DISABLE_THREADS=1 Change-Id: I8c77974acb2b4d4e273fc9c0f273c345d8feb2ff
2017-09-13sax: improve READMEMichael Stahl1-1/+10
Change-Id: Ide71867ca1ad3ae43c18159585df6d0dafcbe586
2017-09-12clang-tidy modernize-use-emplace in package..saxNoel Grandin3-6/+6
Change-Id: Ibc0258fd79df987a0e295552bcc5bf89ee12007a Reviewed-on: https://gerrit.libreoffice.org/42173 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-05tdf#112164 sax: handle errors on last call to XML_Parse()Michael Stahl1-5/+10
If XML_Parse() is called with isFinal=1 and there are open tags, that is an error (XML_ERROR_NO_ELEMENTS) that must be converted to an exception. This reveals that we already had an incomplete input document, which needs to be moved to "fail" now. Change-Id: I7ce3b51bd87923b5edde621508cf38d7ebbc2b14
2017-08-17remove unnecessary use of OUString::getStrNoel Grandin1-12/+12
Change-Id: I3d13e1c0bb6aa4a7aacc463198747c1368ebc9b4 Reviewed-on: https://gerrit.libreoffice.org/38114 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-11sax parser: remove long-disabled codeThorsten Behrens1-135/+0
Entity ref and decl was disabled since 2014, let's remove it now. Change-Id: I35dac78b8530bab99e955bf68dfe3f8951a63f99 Reviewed-on: https://gerrit.libreoffice.org/40998 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2017-08-02remove unnecessary use of 'this->'Noel Grandin3-8/+8
Change-Id: I5c115389af7d24c18ddaf5fbec8c00f35017a5b4 Reviewed-on: https://gerrit.libreoffice.org/40671 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-20sax: Check if it starts with 5 bytes of "<?xml"Takeshi Abe1-3/+3
Change-Id: Iec5b748b188c7b1bf61e8137faf4b3f2d480d7f1 Reviewed-on: https://gerrit.libreoffice.org/40139 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>