Commit graph

8595 commits

Author SHA1 Message Date
Miklos Vajna
9a7768b420 common: wrap SigHandlerTrap in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
SigHandlerTrap:

==26186==ERROR: AddressSanitizer: odr-violation (0x000002090ae0):
  [1] size=40 'SigHandlerTrap' ../common/SigUtil.cpp:76:12
  [2] size=40 'SigHandlerTrap' common/SigUtil.cpp:76:12
These globals were registered at these points:
  [1]:
    #0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f8f537f1d8b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ad8b)

  [2]:
    #0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2bcfe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2bcfe)

Change-Id: I54d5f6d4298848cacd437d302cff0e8c5003fb8c
2019-08-13 09:08:32 +02:00
Tor Lillqvist
a158686422 The SavedClipboards stuff presumably makes no sense for MOBILEAPP
It seems to be strongly related to HTTP things at least in error
handling. So bypass as cleanly as possible in the MOBILEAPP case for
now.

Change-Id: If9540f166293635513a3ab06371f01ad381a8cb2
2019-08-12 13:20:52 +03:00
Tor Lillqvist
98dab7d74f Avoid assertion failure in the iOS app
There is just one process, and the UnitBase::Global is dummy, its type
is irrelevant.

Change-Id: I73fd0c32e50dd698161f25dbc3f4c8655776286a
2019-08-12 13:20:52 +03:00
Tor Lillqvist
5d0c858770 Avoid unexpected exception in the iOS app
There is no "host" or "server name" in the MOBILEAPP case. The
getHost() call throws an exception.

Change-Id: If950f83b2f0b9fa7ee91bf2e2194e637414bff06
2019-08-12 13:20:52 +03:00
Miklos Vajna
1263694944 common: wrap ShutdownRequestFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
ShutdownRequestFlag:

==13663==ERROR: AddressSanitizer: odr-violation (0x00000208f860):
  [1] size=1 'ShutdownRequestFlag' ../common/SigUtil.cpp:60:19
  [2] size=1 'ShutdownRequestFlag' common/SigUtil.cpp:60:19
These globals were registered at these points:
  [1]:
    #0 0x5f9a18 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f9b903f1d0b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ad0b)

  [2]:
    #0 0x5f9a18 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b9fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b9fe)

Change-Id: I247760325f804813249e814dbb4576493619dee7
2019-08-12 09:03:42 +02:00
Sven Strickroth
eaa310aa29 Use -delete command of find instead of -exec rm
The -delete parameter allows to delete several files at once without
the need to spawn a rm processes for every found file.

Note, the -delete parameter is NOT POSIX compliant, however,
it should be available on all relevant systems.

Change-Id: Icc840aecc906700cae0665a592b7e0e7e377bdcb
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Reviewed-on: https://gerrit.libreoffice.org/77084
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-08-10 23:28:56 +02:00
Miklos Vajna
35646b7bf9 common: wrap DumpGlobalState in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
DumpGlobalState:

==5783==ERROR: AddressSanitizer: odr-violation (0x00000208f7a0):
  [1] size=1 'DumpGlobalState' ../common/SigUtil.cpp:49:19
  [2] size=1 'DumpGlobalState' common/SigUtil.cpp:49:19
These globals were registered at these points:
  [1]:
    #0 0x5f9a08 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5c5edf1c9b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ac9b)

  [2]:
    #0 0x5f9a08 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b98e in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b98e)

Change-Id: I4b7b0238eb9b38a30875e8788c1dcb27f1d1643f
2019-08-09 09:23:17 +02:00
Miklos Vajna
bd4d72d41f common: wrap TerminationFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
TerminationFlag:

==11732==ERROR: AddressSanitizer: odr-violation (0x00000208f4a0):
  [1] size=1 'TerminationFlag' ../common/SigUtil.cpp:41:19
  [2] size=1 'TerminationFlag' common/SigUtil.cpp:41:19
These globals were registered at these points:
  [1]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5df9cf18cb in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60a8cb)

  [2]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b4fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b4fe)

Change-Id: Ic620b143ecb77699f40676ff39d0fa7abceb34d5
2019-08-08 09:10:59 +02:00
Tor Lillqvist
c1ebc62c3a Fix build for MOBILEAPP
The iOS app does not work any longer, though. Hits an assertion failure.

Change-Id: Ia135c12a79427e5c2b6c3c98adef4c354d1ceb68
2019-08-07 14:41:37 +03:00
Miklos Vajna
59c9f70c1f test: avoid UB in unit-wopi
==16414==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7f81f8df5510 at pc 0x0000005eb5a4 bp 0x7f81f8df54b0 sp 0x7f81f8df4c60
READ of size 23 at 0x7f81f8df5510 thread T3 (websrv_poll)
    #0 0x5eb5a3 in __interceptor_strlen.part.34 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:365
    #1 0x7f8201d22e47 in std::char_traits<char>::length(char const*) /home/vmiklos/git/libreoffice/lode/packages/gccbuild/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:320
    #2 0x7f8201d22e47 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) /home/vmiklos/git/libreoffice/lode/packages/gccbuild/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:511
    #3 0x7f81fcaa59c3 in WopiTestServer::handleHttpRequest(Poco::Net::HTTPRequest const&, Poco::MemoryInputStream&, std::shared_ptr<StreamSocket>&) /home/vmiklos/git/libreoffice/online-san/test/./WopiTestServer.hpp:237:28

Problem was that the test code assumed a 0-terminated buffer, but that
was not the reality. So specify the buffer size explicitly.

Change-Id: I9a9edfe5623a1136aa77c381d1d3d8b8e1ca2258
2019-08-07 09:11:09 +02:00
Michael Meeks
617a5d69b0 Account for a state change race.
We can have un-processed incoming mesages in transit after a local
transition to WAIT_DISCONNECT including some that change state.

Change-Id: I577aebbc0a6ecca695f4bc35b4d226e1a465817d
2019-08-06 14:50:52 -04:00
Michael Meeks
80fb9ac96f clipboard: unit tests need clipboard tags during init.
Ensure we always have a valid clipboard key at start.

Change-Id: Ia2d37e038d8baa877d147f507a5ff4c867f55813
2019-08-06 14:50:52 -04:00
Mike Kaganski
5cb3423838 Use rich paste also for IE
Change-Id: I220af7fb1d2e7326e61c8ef4f9ec73980f65388b
2019-08-06 14:50:52 -04:00
Michael Meeks
48a998f6f6 copy/paste test - expand to paste.
Change-Id: I69db38511aa70f1c2e7ff9613f49307dfe952bae
2019-08-06 14:50:52 -04:00
Michael Meeks
65c3ba6521 Add test bits for copy/paste.
Change-Id: I7e1b0bf8c834a414d2f8a87bd16ebf8465dd324a
2019-08-06 14:50:52 -04:00
Michael Meeks
c855df8c86 More IE11 work, paste works again, cut/copy pending.
Change-Id: I744e76c7ecb655c42ed3dfb0662c0995d2c48650
2019-08-06 14:50:52 -04:00
Michael Meeks
53bb8261d2 clipboard: remove inadvertent debug.
Change-Id: I59833519d5f4a8b16c7925a8094c974a1e7f5c11
2019-08-06 14:50:51 -04:00
Michael Meeks
cfe70a16c0 clipboard: centralize events, and have a persistent clipboard div.
Change-Id: I94388e144a4a54d98b86c91675e89be932c3502a
2019-08-06 14:50:51 -04:00
Michael Meeks
1508b2da6d clipboard: don't encode empty string as a blob: mends image paste.
Change-Id: I265014ad1186d21aeb8628d8cc124d4d4d3ef91f
2019-08-06 14:50:51 -04:00
Michael Meeks
1e759e4d10 Handle undefined context menu items.
Change-Id: I98727decc5ad7fe2525a2d28f140fa3a39927e5b
2019-08-06 14:50:51 -04:00
Michael Meeks
dd65c20f12 Context menus: stop items looking too much like links.
Change-Id: I9bd469070ba401c97da3547e9d1aaa2ccb83f155
2019-08-06 14:50:51 -04:00
Michael Meeks
90c73cbf54 clipboard: Improve selection management.
Change-Id: I3b6318f9a0cc544b74564376426baf7d3759ee3e
2019-08-06 14:50:51 -04:00
Michael Meeks
c4f36953c4 Switch to using beforecopy etc. to setup the selection.
Change-Id: I432bcdaeba84eaac8925673f4d6b33a0d10f0a97
2019-08-06 14:50:51 -04:00
Michael Meeks
23d748947c clipboard: use <a href='#' and click overriding to get copy/paste on iOS
Since context click vs. mouse-up is a global, we have to do all our
contexts.

Change-Id: Ie50a832d1b9df066cfccc2138f0741f8d407a1a4
2019-08-06 14:50:51 -04:00
Michael Meeks
8956a8f203 Avoid harmful stopHideDownload while populating the clipboard.
Change-Id: I1e3dec1d76f204fca84dc4a0d53f4ac02175288a
2019-08-06 14:50:51 -04:00
Michael Meeks
da7790db46 Separate exception handling for iOS and Android postmessages.
Change-Id: I618123dab29fb0e24f92b1bf7fb4bfa76e1dd709
2019-08-06 14:50:51 -04:00
Ashod Nakashian
b9674d51cd leaflet: Improve handling of paste without source document
Improve on handling paste without download and
handles onerror properly, which invokes the error
handler callback (where provided) where previously
it was ignored.

Change-Id: I3b527516dc4f90484fd1cfba411b45ff948ffc53
2019-08-06 14:50:51 -04:00
Ashod Nakashian
9a0bb531eb wsd: Logging corrections
Change-Id: Ib4472c203d29992f08966a78961ab364e589f8d0
2019-08-05 22:21:54 -04:00
Ashod Nakashian
d12227c839 wsd: send clipboard key on loading
While we don't send the clipboard key
to the client during the construction
of ClientSession, we do so upon handshake
(loolclient message), and by then our state
is no longer DETACHED, rather it is LOADING.

This restores copy/paste across documents.

Change-Id: I0db50210f232afa05b1273edeb2cc163fd07c504
2019-08-05 22:21:54 -04:00
Michael Meeks
9e791fb0d4 clipboard: persist selections for a while after a view closes.
re-factor ClientSession state to be a simpler state machine.
Have a nice disconnect / disconnected handshake on view close.

Change-Id: Ie933cc5c7dfab46c66f4d38a4d75c459aa1cff87
2019-08-05 22:21:54 -04:00
Ashod Nakashian
2492faf225 wsd: add 'meta origin' to clipboardcontent payloads too
Change-Id: I61233fd9b2559a28a0da67dd0a869e97c8b34da7
2019-08-05 21:58:10 -04:00
Ashod Nakashian
fae1a967db leaflet: catch exceptions form paste postMessage
Change-Id: I06676f0ebdf798db095ea6d70e84907e5c318ac4
2019-08-05 21:58:03 -04:00
Michael Meeks
710ce605c8 clipboard: IE11 rich paste works.
Change-Id: Ifa05aa0cf5e84f4ccd5414f45857aee34aa05f1c
2019-08-05 21:57:09 -04:00
Michael Meeks
98d120d19b This to that.
Change-Id: Ic690751e42b0f906db7b327d5d8082028ef492dd
2019-08-05 21:57:03 -04:00
Michael Meeks
3fd1423a29 clipboard: get image paste working for Edge.
Change-Id: I35c12e094e16f966f1be9c631c6d7023954504f0
2019-08-05 21:56:58 -04:00
Michael Meeks
6fbb3fef36 clipboard: ensure image fallback works for paste.
Don't return an empty blob for no textual content case.

Change-Id: I592d0e7f876b7ecbe86f769cbb7fdd4a2183531b
2019-08-05 21:56:53 -04:00
Michael Meeks
23db67341c IE11 - get copy/paste happy again.
Change-Id: I42a74a04a6f3f3fb7eff617a2003084174108464
2019-08-05 21:55:01 -04:00
Michael Meeks
5f27b235e3 Fix this to that.
Change-Id: I978092973244ac80cdf68ed539f30c3272b6a615
2019-08-05 21:53:19 -04:00
Michael Meeks
326391325e clipboard: having downloaded the complex selection, don't do it again.
Instead use the result.

Change-Id: Ife2093d6d69c2598079fee7a543044378e2b6829
2019-08-05 21:53:11 -04:00
Michael Meeks
7f43d5d385 Use isComplex for calc too.
Change-Id: Ib209cca53079cb9d63a8955caf80945c7ea455d4
2019-08-05 21:53:06 -04:00
Michael Meeks
bc9ea43af1 Don't let the clipboard 'Download' button linger around continually.
NB. can't use text-selection as a trigger to hide it, but use another
copy/cut/paste etc.

Change-Id: Iebf07a2fb8900b71134fcdac011336d87ab01e6a
2019-08-05 21:53:01 -04:00
Szymon Kłos
869248929c Allow paste from external clipboard in dialogs
Change-Id: Ife7a32ada356a3a594bdd314ff5a0a4b7d10eb50
2019-08-05 21:52:41 -04:00
Michael Meeks
181af63b56 Attempt to use a RichDocuments postmessage for paste before giving up.
Change-Id: I62b8a7d0a4ed9612f42f0e4a3acb75e52ab32c97
2019-08-05 21:49:33 -04:00
Ashod Nakashian
b57f6474dd leaflet: graphics are always complex
Change-Id: I56c5c185c3eeb50ce3c4674dbddce217982cb40a
2019-08-05 21:49:13 -04:00
Marco Cecchetti
1eabf060a5 loleaflet: fix downloadprogress issue for cross copy-paste
Change-Id: If9e76d6c477da773913ee18ef33349c42a3d7ff0
2019-08-05 21:47:23 -04:00
Michael Meeks
229b0288da Tweak strings before translation.
Change-Id: I3f9817af6439518dff63731fed720e0cf60135ef
2019-08-05 21:47:19 -04:00
Marco Cecchetti
8621eb993b loleaflet: warning about large copy paste remove username check
Change-Id: I5a6fffbe20883b30617242765a687de02c55d2d7
2019-08-05 21:47:13 -04:00
Marco Cecchetti
2dffb37318 loleaflet: DownloadProgress avoid circular issue with _doAsyncDownload
Change-Id: I94364258e83e77dbb49dfb4b2d891b18141529a5
2019-08-05 21:47:08 -04:00
Michael Meeks
7cb3b634ad clipboard: we still need to detect single graphic selections.
graphic selections are automagically 'too big'.

Change-Id: Idc8baa17257eff01a6bcae958bffbbcfeea6138c
2019-08-05 21:47:00 -04:00
Marco Cecchetti
1ffefd87f2 loleaflet: fixed minor issues
Change-Id: Ia22688b6a577ee4d8da6d1c11870db8a2aaf95d1
2019-08-05 21:46:55 -04:00