aboutsummaryrefslogtreecommitdiffstats
path: root/common/rdr
Commit message (Collapse)AuthorAgeFilesLines
* Be defensive about overflows in stream objectsPierre Ossman2019-12-2013-48/+75
| | | | | | | | | | | | | | We use a lot of lengths given to us over the network, so be more paranoid about them causing an overflow as otherwise an attacker might trick us in to overwriting other memory. This primarily affects the client which often gets lengths from the server, but there are also some scenarios where the server might theoretically be vulnerable. Issue found by Pavel Cheremushkin from Kaspersky Lab. (cherry picked from commit 75e6e0653a48baf474fd45d78b1da53e2f324642)
* Use size_t for lengths in stream objectsPierre Ossman2019-12-2024-155/+156
| | | | | | | | | | Provides safety against them accidentally becoming negative because of bugs in the calculations. Also does the same to CharArray and friends as they were strongly connection to the stream objects. (cherry picked from commit 0943c006c7d900dfc0281639e992791d6c567438)
* Remove unused FixedMemOutStreamPierre Ossman2019-12-201-52/+0
| | | | (cherry picked from commit 4ff58f0acaeb566b79ae12cf013b376eaaaab834)
* Make ZlibInStream more robust against failuresPierre Ossman2019-12-202-7/+8
| | | | | | | | | | | | | | Move the checks around to avoid missing cases where we might access memory that is no longer valid. Also avoid touching the underlying stream implicitly (e.g. via the destructor) as it might also no longer be valid. A malicious server could theoretically use this for remote code execution in the client. Issue found by Pavel Cheremushkin from Kaspersky Lab (cherry picked from commit d61a767d6842b530ffb532ddd5a3d233119aad40)
* Do proper logging rather than fprintf(stderr, ...)Pierre Ossman2019-04-292-11/+17
|
* Remove commented out loggingPierre Ossman2019-04-291-10/+0
|
* Remove Java web serverPierre Ossman2018-10-091-102/+0
| | | | | Applets don't work anymore so remove everything that has to do with serving them.
* Fix bad reference in TLSException initialiserPierre Ossman2018-05-291-1/+1
|
* Fully standardise on send()/recv()Pierre Ossman2017-11-082-7/+6
| | | | We already assume sockets here since we use select().
* Added my/Cendio copyright where relevantPeter Åstrand (astrand)2017-11-081-0/+1
|
* Use send() with MSG_DONTWAIT when possiblePeter Åstrand (astrand)2017-11-081-1/+9
|
* Make exception classes have clearer messagesPierre Ossman2017-10-121-6/+2
| | | | | Include the type of exception in the string generated by each subclass. Also simplify the constructs to what is needed.
* rdr: Fix incorrect error checking after fread()Steve Kondik2017-07-081-3/+3
| | | | | | | | | fread() returns size_t, which is unsigned. Don't check for negative values to avoid warnings from Clang. /home/shade/dev/tigervnc/common/rdr/FileInStream.cxx:74:13: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] if (n < 0 || ferror(file)) ~ ^ ~
* Add missing virtual destructorsSteve Kondik2017-07-081-0/+1
| | | | | | | | | | | | | | Fix warnings emitted by Clang: /home/shade/dev/tigervnc/common/rdr/FdInStream.h:30:9: error: 'rdr::FdInStreamBlockCallback' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] class FdInStreamBlockCallback { ^ In file included from /home/shade/dev/tigervnc/common/network/TcpSocket.cxx:44: In file included from /home/shade/dev/tigervnc/common/network/TcpSocket.h:31: /home/shade/dev/tigervnc/common/network/Socket.h:82:9: error: 'network::ConnectionFilter' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] class ConnectionFilter { ^ ..etc
* Fix busy loop in FdOutStream::flush()Pierre Ossman2016-10-101-1/+6
| | | | | | | This bug was introduced in c6df31db. A non-blocking socket that did not have any more space would busy loop until the write succeeded. Instead now it returns without any action, just as it did before the bug was introduced.
* Clean up FdOutStream::flush()Pierre Ossman2016-04-291-21/+3
| | | | The logic was a bit confusing and superfluous.
* Remove Windows 98 socket workaroundPierre Ossman2016-04-291-26/+22
| | | | We haven't supported such an old version of Windows for some time.
* Clear up ZlibInStream::reset() behaviourPierre Ossman2015-11-272-15/+43
| | | | | | | | | It previously only did a reset of the ZlibInStream object, not the underlying zlib stream. It also had the side effect of flushing the underlying stream and disassociating from it. Clear things up by changing the naming, and introducing a proper reset function (which is needed by the Tight decoder).
* Add efficient method to copy data between two streamsPierre Ossman2015-11-271-0/+12
|
* Remove unneeded virtual qualifiers on stream methodsPierre Ossman2015-11-272-2/+2
|
* Remove old Windows CE codePierre Ossman2015-11-091-9/+0
|
* Use mingw's gettimeofday()Pierre Ossman2015-11-091-33/+1
| | | | | mingw has a perfectly functional gettimeofday() so use that instead of having multiple copies of our own version.
* Avoid dropping const qualifier needlesslyPierre Ossman2015-09-291-1/+1
|
* Fix Winsock errno code overlapPierre Ossman2015-05-292-2/+2
| | | | | Some Winsock errno:s conflict with the standard ones. Try to restrict the redefines to things relevant for sockets.
* Merge branch 'upreqs' of https://github.com/CendioOssman/tigervncPierre Ossman2015-03-125-63/+15
|\ | | | | | | | | | | Conflicts: contrib/packages/rpm/el5/SPECS/tigervnc.spec vncviewer/Viewport.cxx
| * Raise GnuTLS requirements to 3.xPierre Ossman2015-01-295-63/+15
| | | | | | | | | | | | This allows us to simplify things by getting rid of some old compatibility code. People should really be using current versions of GnuTLS anyway to stay secure.
* | Fix bad signed/unsigned comparisonsPierre Ossman2015-03-033-3/+3
| | | | | | | | | | Either by casting, or switching to a more appropriate type for the variable.
* | Make sure Exceptions do not use unsafe format stringsPierre Ossman2015-03-033-12/+5
| |
* | Tag the Exception constructor as a printf functionPierre Ossman2015-03-031-1/+7
| | | | | | | | | | This allows the compiler to analyse the format strings and arguments for correctness.
* | Merge branch 'perf' of https://github.com/CendioOssman/tigervncPierre Ossman2015-02-133-0/+138
|\ \
| * | Add stream class to feed data from a filePierre Ossman2015-02-133-0/+138
| |/
* / Use a common header file for Windows errno names.Peter Åstrand (astrand)2015-02-052-5/+2
|/ | | | | | | | In earlier Visual Studio and MinGW editions, BSD socket errno:s were left undefined. This is no longer the case. This may cause build or runtime errors. To avoid this, we are using a common header file which corrects all definitions. This header will also be used with other projects such as sercd, unfs3, PulseAudio etc.
* Move ws2_32 dependency to the correct placePierre Ossman2014-10-171-2/+2
| | | | It is rdr and network that needs it, not vncviewer.
* Use printf constructor safelyPierre Ossman2014-07-211-1/+1
| | | | | The input string might contain formatting marks, so make sure those are ignored.
* Push encoding specific formats into the encoders and decodersPierre Ossman2014-07-072-48/+0
| | | | Keep the generic stream classes clean and general.
* Remove a lot of platform compatibilty stuffPierre Ossman2014-07-073-29/+5
| | | | It's either not used, or no longer relevant.
* GnuTLS 3.x has removed gnutls_transport_set_global_errno() in favour ofPierre Ossman2012-07-033-11/+51
| | | | | | | | gnutls_transport_set_errno(). Make sure we call the right errno function depending on which GnuTLS we're using. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4922 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Refactor the TLS code so that the push/pull functions are aware of theirPierre Ossman2012-07-034-10/+24
| | | | | | | containing stream object. This is in preparation for supporting GnuTLS 3.x. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4921 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Add method to query how long since we last wrote something to a fd.Pierre Ossman2011-11-152-0/+17
| | | | git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4802 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Make socket writes non-blockable. This allows the system to more quicklyPierre Ossman2011-10-252-11/+75
| | | | | | | | return back to the Xorg main loop, meaning that things will be more responsive in the presence of slow VNC clients. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4735 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Another attempt at solving the compression level change problems. We were stillPierre Ossman2011-10-182-63/+75
| | | | | | | not detecting the correct approach properly, and hence still getting crashes. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4731 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Move setting of PIC code to a central locationDRC2011-08-231-8/+0
| | | | git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4648 3789f03b-4d11-0410-bbf8-ca57d06f2519
* CMake doesn't handle convenience libraries as nicely as autotools does. WePierre Ossman2011-08-221-0/+8
| | | | | | | need to be explicit with -fPIC here as we use these in libvnc.so. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4645 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Make rawBytesEquivalent an unsigned 64-bit integer. Otherwise, it will ↵DRC2011-08-191-0/+1
| | | | | | overflow in less than a minute if using a full-screen video or 3D application. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4639 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Ported encoding optimizations from TurboVNC. The changes to the Tight ↵DRC2011-08-111-1/+1
| | | | | | parameters were determined through extensive low-level profiling (see http://www.virtualgl.org/pmwiki/uploads/About/turbototiger.pdf). The other enhancements involved: (1) porting the solid subrectangle pre-computation code from TightVNC/TurboVNC (it makes a pretty big difference-- see report), (2) encapsulating the JPEG encoder in its own class (this eliminates a buffer copy, and the JPEG buffer is now set to a decent size where it shouldn't ever need to be paged or re-allocated, except in rare corner cases), (3) adding support for last rect. encoding (necessary to support the solid rectangle pre-computation enhancements. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4626 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Merge further fixes to Zlib encoder from 1.1 branchDRC2011-08-092-6/+28
| | | | git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4623 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Revert r4498 and fix #3305357 properly. The issue was two-fold: (1) the ↵DRC2011-08-091-9/+12
| | | | | | compress buffer allocated by the Tight encoder was not large enough, and (2) Zlib 1.2.5 can sometimes call deflate(..., Z_BLOCK) within the body of deflateParams(), so we need to check avail_in after calling checkCompressionLevel() to ensure that there is still data left to compress before we call deflate() again. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4617 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Remove unused autotools build systemDRC2011-06-241-26/+0
| | | | git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4540 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Do not run libtool_create_control_file() on Windows. Windows does not like it.DRC2011-06-241-1/+3
| | | | git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4530 3789f03b-4d11-0410-bbf8-ca57d06f2519
* Fix 3305357 (Enabling custom compression level on client crashes server)DRC2011-06-181-6/+8
| | | | git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4508 3789f03b-4d11-0410-bbf8-ca57d06f2519