Found with readability-container-size-empty
This has the potential for extra performance as it's not checking for
every single element.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Found with performance-for-range-copy
Avoids unnecessary copying when the loop does not modify the variable.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Found with modernize-use-equals-default
default allows extra optimization compared to an empty con/destructor.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Found with modernize-use-override
This can be useful as compilers can generate a compile time error when:
The base class implementation function signature changes.
The user has not created the override with the correct
signature.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
Fix this error reported by some older Gnu C++ compilers:
./server/tests/test-display-base.cpp:818:1: sorry, unimplemented: non-trivial designated initializers not supported
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Like char devices, QXL devices need to be explicily started.
For some historical reason, char devices are started when in running
state. See commi bf1d9007b. Reading that commit comments, there was a
plan to provide an API to stop/start devices invidually, but that never
happened. Whether that API would really be useful now, I wonder.
For now, just follow the char devices behaviour and start QXL devices
added when vm_running.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.uuuuucom>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
If the worker is already started, don't assert and just return.
This fixes calling spice_server_vm_start() multiple times.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
- remove entry for g-type-register-static: the "possible" flag has been
re-introduced in glib.supp
- add new entries for several calloc issues
Signed-off-by: Julien Ropé <jrope@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Reduce code duplication.
Also this improve support for big endian machines as
agent_check_message fix also message endianess.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <ulublin@redhat.com>
Big endian machines on server are not officially supported but won't
hurt.
Messages from client are always encoded as little endian (as all
SPICE protocol).
Convert fields from little endian to host endian on some places
where numbers are used and not just binary copied.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <ulublin@redhat.com>
This brings in the following changes:
Frediano Ziglio (18):
snd_codec: Use better types for snd_codec_is_capable
snd_codec: Use better type for function result
snd_codec: Use better type for snd_codec_create mode
backtrace: Do not attempt to compile if spice_backtrace is empty
Avoid usage of GCC extension for __VA_ARGS__ where possible
helper-fuzzer-demarshallers: Provide replacement for ftello for MSVC
quic_tmpl: Remove unused bpc parameter
ssl_verify: Do not check IP if we fail to resolve it
proto: Add support for side mouse buttons
quic: Constify a parameter
quic: Fix typo in comment
agent: Extend agent_check_message to support VDAgentMonitorsConfig extension
quic: Check we have some data to start decoding quic image
quic: Check image size in quic_decode_begin
quic: Check RLE lengths
quic: Avoid possible buffer overflow in find_bucket
test-quic: Add fuzzer capabilities to the test
test-quic: Add test cases for quic fuzzer
Haochen Tong (2):
pixman_utils: fix clang "unused functions" warning
marshal: fix clang "missing field initializer" warning on generated files
Marc-André Lureau (1):
agent: fix vdagent monitor flag filtering
Changes in sound.cpp are required due to improved types.
In particular some security related changes are imported.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <ulublin@redhat.com>
In configure.ac the micro version is incremented if there is a
forth component in the version.
In Meson this was wrongly translated to "if contains git".
This fixes Gitlab issue #46.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Remove some possible warning, like
reds.cpp:216:18: warning: 'remove_client' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual void remove_client(RedCharDeviceClientOpaque *opaque);
^
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <ulublin@redhat.com>
Some compiler could generate some warning, like
reds.cpp:2678:5: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(buf, pass);
^
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Jakub Janků <jjanku@redhat.com>
Extend mouse button bits support.
Allows to support up to 16 buttons.
Partly based on a patch from Kevin Pouget (RED_MOUSE_BUTTON_STATE_TO_AGENT
macro, updated on new protocol constants).
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
The regression was introduced by
commit 22fc6a48e6
red-channel-client: Change GQueue into a std::list
Starts using smart pointers in the queue.
dcc_add_surface_area_image added a new pipe item in front if pos was
NULL. Before the commit red_add_lossless_drawable_dependencies passed
a pointer to the last element in the pipe adding the new item on the
back. The change caused the item to be inserted in front instead of
back. Restore the insert position.
This caused in some condition the pipe to grow uncontrollably (like
using a large notepad window on Windows 7 and moving it around).
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Let the compiler decide.
Apparently it causes CI makecheck to fail (see below).
Seems to me it's a gcc problem -- was working with version 9,
fails with version 10.
Making the function a non-inline one "fixes" this issue.
Alternatively adding to the structure "int dummy" above the "int type"
"fixes" the build too (but I went with the non-inline solution).
==== error ====
CC mjpeg-encoder.lo
In file included from /usr/include/string.h:495,
from ../../server/red-common.h:24,
from ../../server/mjpeg-encoder.c:25:
In function ‘memset’,
inlined from ‘mjpeg_encoder_reset_quality’ at ../../server/mjpeg-encoder.c:385:5,
inlined from ‘mjpeg_encoder_quality_eval_stop.part.0’ at ../../server/mjpeg-encoder.c:999:5:
/usr/include/bits/string_fortified.h:71:10: error: ‘__builtin_memset’ offset [788, 871] from the object at ‘encoder’ is out of the bounds of referenced subobject ‘type’ with type ‘int’ at offset 784 [-Werror=array-bounds]
71 | return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../server/mjpeg-encoder.c: In function ‘mjpeg_encoder_quality_eval_stop.part.0’:
../../server/mjpeg-encoder.c:96:9: note: subobject ‘type’ declared here
96 | int type;
| ^~~~
cc1: all warnings being treated as errors
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Provide constructor and destructor, use new/delete.
This allows additional fields to be properly initialized if needed.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
Remove some conditional compilation.
Make try_compress_lz4 return success or failure and change the
messages making easier to read result from try_compress_lz4.
Remove "n" parameter from try_compress_lz4, use message size
instead.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
Reduces usage of manual reference counting.
Avoids usage of new and use instead red::make_shared to both
create and own pipe items.
Use move semantic to reduce useless copies.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
Now that items are managed by constructors/destructors avoid some
manual releases.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
Provides a base class to allows RedCharDeviceVDIPort to pass
a RedPipeItem to MainChannelClient instead of having to wrap
into another item.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
Most of the times each class has an associated constant so
allows to be able to define the constant at declaration time.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
This allows to:
- reuse reference counting;
- avoid having to manually call g_free to release item memory;
- assure item is initialized;
- avoids some manual casts.
It will also allows to use smart pointers.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>