Commit Graph

548 Commits

Author SHA1 Message Date
Caolán McNamara
ffb19c5be4 ofz#3752 Integer-overflow
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-25 16:00:08 +02:00
Noel Grandin
83fd71e041 loplugin:constmethod in tools,sax,UnoControls
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-25 10:56:03 +02:00
Caolán McNamara
89dd6ff111 ofz#3769 Integer-overflow
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-25 09:56:28 +02:00
Stephan Bergmann
5209ee4791 loplugin:includeform: sax
Change-Id: If54794f72502a11612e85f99713e553f91d4025e
2017-10-23 22:45:57 +02:00
Noel Grandin
87a9979c89 overload std::hash for OUString and OString
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-23 08:15:35 +02:00
Noel Grandin
2c05d758b2 add << operator for css::uno::Exception
Change-Id: Ia23dafd07133779144965682df3b7125a3214235
Reviewed-on: https://gerrit.libreoffice.org/43046
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
2017-10-04 15:18:00 +02:00
Caolán McNamara
5e381ffbe7 allow events to accumulate past limit if an exception is pending
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-18 22:19:31 +02:00
Caolán McNamara
1ebf34c671 protect against short file
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-17 21:38:24 +02:00
Caolán McNamara
4025422a53 ofz: string has to be at least 5 chars long
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-17 18:22:32 +02:00
Caolán McNamara
8508e409a2 ofz: leak on fdo72541-1.fodt
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-16 18:13:01 +02:00
Stephan Bergmann
3f0fba004b New rtl::isUnicodeScalarValue, rtl::isSurrogate
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 8e0fb74dc0
"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-13 13:35:49 +02:00
Michael Stahl
403c772973 sax: allow some debug logging in FastParser
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-13 11:11:36 +02:00
Noel Grandin
65e293f524 clang-tidy modernize-use-emplace in package..sax
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-12 08:03:09 +02:00
Michael Stahl
e530a7ddb1 tdf#112164 sax: handle errors on last call to XML_Parse()
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-09-05 22:34:59 +02:00
Noel Grandin
9881bea8d4 remove unnecessary use of OUString::getStr
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-17 11:55:13 +02:00
Thorsten Behrens
840a97f98f sax parser: remove long-disabled code
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-11 09:40:14 +02:00
Noel Grandin
3dcf6dfcee remove unnecessary use of 'this->'
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-08-02 13:45:36 +02:00
Takeshi Abe
b64e564492 sax: Check if it starts with 5 bytes of "<?xml"
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>
2017-07-20 15:52:43 +02:00
Chris Sherlock
9af8964dd2 RTL_UNICODETOTEXT_INFO_{DEST|SCR}BUFFERTOSMALL should use TOO, not TO
I have kept the old mispelled constant for backwards compatibility

Change-Id: I128a2eec76d00cc5ef058cd6a0c35a7474d2411e
Reviewed-on: https://gerrit.libreoffice.org/39995
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-07-17 21:47:38 +02:00
Noel Grandin
d5f94d9318 loplugin:constparams in basegfx,sax,shell
Change-Id: I90a9d105a6db146ae64cff56983def94b9472a95
Reviewed-on: https://gerrit.libreoffice.org/40043
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-17 11:30:43 +02:00
Ashod Nakashian
2c4c083205 comphelper: move base64 encode/decode helpers from sax
Change-Id: I02e33793736003f36976bc8b518c389a31082dbe
Reviewed-on: https://gerrit.libreoffice.org/39991
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2017-07-16 18:25:25 +02:00
Noel Grandin
4b2262ab5b new loplugin unnecessaryparen
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>
2017-07-05 11:08:48 +02:00
Stephan Bergmann
592ab6435b loplugin:casttovoid: sax
Change-Id: Id8ac78d146dc63168fe9f76c94cd1bf0d2b1b6d9
2017-07-02 22:30:59 +02:00
Mohammed Abdul Azeem
b3b6ce3feb Added find function to FastAttributeList:
It returns a FastAttributeIter, which can be used to
obtain value in different formats directly. Also, avoids
one unnecessary iteration.

Change-Id: Ic28e0177100738bbd71a3a89634cae9f1f7ee996
Reviewed-on: https://gerrit.libreoffice.org/39380
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-06-29 17:50:12 +02:00
Noel Grandin
979c8c56b7 loplugin:oncevar in oox..sax
Change-Id: I0fee8bcddaeea48335e3be05761d2ad2c45020e2
Reviewed-on: https://gerrit.libreoffice.org/39238
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-26 08:56:47 +02:00
Noel Grandin
0f347c04bf loplugin:unusedfields in registry..sax
Change-Id: Ie0e2ecaadb49273cb4e78bc894111523940e7c8e
Reviewed-on: https://gerrit.libreoffice.org/39098
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-23 08:58:43 +02:00
Eike Rathke
c5bc40ae6c Literal tab character is bad XML, write '&#9;' instead
Additionally, it *may* have caused document corruption when loading such an
.xlsx file, though a small test case with an embedded literal tab character
could not reproduce the behaviour.
See
https://ask.libreoffice.org/en/question/100615/sudden-corruption-of-xlsx-file-bug/
and note that the literal tab character is a mere assumption, but it would be
possible.

Change-Id: Ia9d33955f1196222d335a1a4807fba78df4e4d85
2017-06-16 23:18:42 +02:00
Mohammed Abdul Azeem
420cecf558 [API CHANGE] Add processingInstruction event to XFastDocumentHandler:
Also made changes in FastParser impl. to emit this event. I've made use
of existing namespace and element name strings to store target
and data for this event.

Change-Id: I6f00cd1172552dd9a74ec22190bef3d2289ae515
Reviewed-on: https://gerrit.libreoffice.org/38784
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-06-15 11:08:20 +02:00
Noel Grandin
d43fc40718 convert SAX_ARGS_ARG macros to varargs template methods
Leave the macros in place for now, because there is still more of this
stuff in sc/../xestream.hxx

Change-Id: I633e12ee572010823e0a223b529a07b00e707b78
Reviewed-on: https://gerrit.libreoffice.org/38295
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-06-01 15:42:43 +02:00
Jochen Nitschke
959496794c cleanup osl/diagnose.h includes
with command
> git grep -l osl/diagnose.h *.cxx |
  xargs grep -L -w 'OSL_\w*' |
  xargs sed -i '/#include *\(<\|\"\)osl\/diagnose.h\(>\|\"\).*/d'

headers need more work

Change-Id: I906519ebbd47a04703b4fa5943b2f7abea7a97ab
Reviewed-on: https://gerrit.libreoffice.org/37350
Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-05-09 15:41:46 +02:00
Stephan Bergmann
40b9caf882 loplugin:salunicodeliteral: sax
Change-Id: I4e571ac28a63a8856a79af44ec0683eca91aee0b
2017-04-28 18:26:57 +02:00
Noel Grandin
3a36cf434f loplugin:checkunusedparams in configmgr and vcl
Change-Id: I7226d01f38e6edaf3868d7267d9b02dbdbc9e5ba
Reviewed-on: https://gerrit.libreoffice.org/36975
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-28 08:32:56 +02:00
Chris Sherlock
da64d198ec tools: svstream.hxx needs only errcode.hxx & not errinf.hxx
Change-Id: Ia28e35ae5af4f601e9a586a3deffbcd61702b0ca
Reviewed-on: https://gerrit.libreoffice.org/36896
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-04-25 09:31:31 +02:00
Stephan Bergmann
12162c8297 Improved loplugin:redundantcast, static_cast on arithmetic types: sax
Change-Id: I4f7c635af8d9d02657d978c08175833fb45adcbf
2017-04-06 18:31:53 +02:00
Andrea Gelmini
2e9fe26014 Fix typos
Change-Id: I5fc62060e7d01c6b492a0e91323f753cc676bf71
Reviewed-on: https://gerrit.libreoffice.org/35639
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-25 11:11:09 +00:00
Eike Rathke
8b25b67d52 escape invalid XML characters with _xHHHH_ when writing escaped
As defined in OOXML, see code comments.

Change-Id: I8ce0075790f2d4ef6227a9474c68466e0793dce2
Reviewed-on: https://gerrit.libreoffice.org/34824
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
2017-03-03 16:27:21 +00:00
Eike Rathke
baca2ec8d5 FastSaxSerializer: SAL_WARN() when writing invalid XML characters
This catches things for OOXML, that could be escaped using _xHHHH_

Change-Id: I937f67dc5edd3c0e5727d74bebb736dc82bdc53d
2017-02-28 22:29:36 +01:00
Stephan Bergmann
3d441992df Better make the zero-initialization more explicit
...if initializing mbIsAttributesEmpty is necessary at all; a bit hard to tell
from the code.

Change-Id: Ia19014b4bf6bb2c41d11ee0afb43fe6bf7da1fcb
2017-02-23 08:49:28 +01:00
jan iversen
ab92c84dfe Revert "Fix typos"
This reverts commit ffd7f8fcfc.

Caused some problems, need to be broken down.

Change-Id: Iee816a266c32e7cebe623d36300c13d079e77c52
Reviewed-on: https://gerrit.libreoffice.org/34534
Reviewed-by: jan iversen <jani@libreoffice.org>
Tested-by: jan iversen <jani@libreoffice.org>
2017-02-22 08:46:44 +00:00
Andrea Gelmini
ffd7f8fcfc Fix typos
Change-Id: I61764094dd6f8e13f29ca554373d30d1d5def447
Reviewed-on: https://gerrit.libreoffice.org/34476
Reviewed-by: jan iversen <jani@libreoffice.org>
Tested-by: jan iversen <jani@libreoffice.org>
2017-02-22 07:21:20 +00:00
David Ostrovsky
996960f5a2 MSVC 14.0: Fix warning C4702: unreachable code
Change-Id: I38db92984daae40981f2d3f60c4efa38684d5328
Reviewed-on: https://gerrit.libreoffice.org/34382
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Ostrovsky <david@ostrovsky.org>
2017-02-20 09:00:57 +00:00
Stephan Bergmann
6dce9c6757 Add missing #includes
...and remove some unncessary using directives/declarations, in preparation of
removing now-unnecessary #includes from cppumaker-generated files, post
e57ca02849 "Remove dynamic exception
specifications".

Change-Id: Iaf1f268871e2ee1d1c76cf90f03557527ebc9067
2017-02-06 17:21:16 +01:00
Noel Grandin
d7363da21d fix linux build
after commit 1461ebb
"expand out ::sax::Converter::convertNumber to OUString::number"

Change-Id: Ie219db074a626b124cc640612e549ec9ac869296
2017-02-02 10:29:06 +02:00
Noel Grandin
1461ebbbb5 expand out ::sax::Converter::convertNumber to OUString::number
which results in much simpler code overall, there is no need to go via
an OUStringBuffer all the time

Change-Id: I69eba92c93f471fa9a45f97c29c56dcf3cd1ebf8
Reviewed-on: https://gerrit.libreoffice.org/33773
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-02 08:00:10 +00:00
Stephan Bergmann
e57ca02849 Remove dynamic exception specifications
...(for now, from LIBO_INTERNAL_CODE only).  See the mail thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html>
"Dynamic Exception Specifications" for details.

Most changes have been done automatically by the rewriting loplugin:dynexcspec
(after enabling the rewriting mode, to be committed shortly).  The way it only
removes exception specs from declarations if it also sees a definition, it
identified some dead declarations-w/o-definitions (that have been removed
manually) and some cases where a definition appeared in multiple include files
(which have also been cleaned up manually).  There's also been cases of macro
paramters (that were used to abstract over exception specs) that have become
unused now (and been removed).

Furthermore, some code needed to be cleaned up manually
(avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no
configurations available that would actually build that code.  Missing @throws
documentation has not been applied in such manual clean-up.

Change-Id: I3408691256c9b0c12bc5332de976743626e13960
Reviewed-on: https://gerrit.libreoffice.org/33574
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26 12:54:43 +00:00
Noel Grandin
ef2b4342e9 loplugin: unnecessary destructor oox..sax
Change-Id: Ie12bfabc92bce04d702f3e77aa5896366e49245e
Reviewed-on: https://gerrit.libreoffice.org/33509
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-25 08:15:36 +00:00
Stephan Bergmann
b814e4d050 New loplugin:dynexcspec: Add @throws documentation, sax
Change-Id: If43818ca79bf134a5025ed184c201f4129630500
2017-01-19 18:03:15 +01:00
Mike Kaganski
18ae77a065 Also consider saved exceptions when mbEnableThreads is true
Previously, saved exceptions are only checked in FastSaxParserImpl::parse(),
which is used in case mbEnableThreads is false (when data in input stream
is no more than 10000). This patch also enables the same check for the
other case.

Change-Id: Ie718556b7c01322e30698515ecd331b7ebad4105
Reviewed-on: https://gerrit.libreoffice.org/33249
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-01-19 07:02:09 +00:00
Noel Grandin
90df5ee107 new loplugin: useuniqueptr: jvmfwk..sax
Change-Id: I732e2e22c6f953f0982fbc8833453e7c23cf9d49
Reviewed-on: https://gerrit.libreoffice.org/33166
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-17 06:41:54 +00:00
Stephan Bergmann
cffac9e59b New loplugin:conststringvar: sax
Change-Id: I110325963655391bb6223f132fcaab2b95f3c9e3
2017-01-10 08:11:03 +01:00