Rosen Penev
e2848118bf
clang-tidy: use C++ casting
...
Found with google-readability-casting
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-09-28 09:36:49 +01:00
Rosen Penev
5513bce73e
clang-tidy: replace C headers with C++
...
Found with modernize-deprecated-headers
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2021-08-26 07:35:09 +01:00
Frediano Ziglio
708cd97212
red-parse-qxl: Encapsulate QXL resource management
...
Reuse code.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:14 +01:00
Frediano Ziglio
b6aa5798b7
red-parse-qxl: Use a base reference class for RedDrawable
...
Don't code manually reference counting for this structure
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:12 +01:00
Frediano Ziglio
110b97e51e
red-parse-qxl: Use a base reference class for RedUpdateCmd
...
Don't code manually reference counting for this structure
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:10 +01:00
Frediano Ziglio
45f2d94ac3
red-parse-qxl: Use a base reference class for RedMessage
...
Don't code manually reference counting for this structure
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:09 +01:00
Frediano Ziglio
6eac8cc08f
red-parse-qxl: Use a base reference class for RedSurfaceCmd
...
Don't code manually reference counting for this structure
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:07 +01:00
Frediano Ziglio
1d4fb2fee7
red-parse-qxl: Use a base reference class for RedCursorCmd
...
Don't code manually reference counting for this structure
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-04 13:01:05 +01:00
Rosen Penev
aefcd7d1c4
clang-tidy: use uppercase numeric literals
...
Found with readability-uppercase-literal-suffix
Avoids readability problems between lower case l and uppercase I.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2021-05-09 07:00:21 +01:00
Frediano Ziglio
8c458fa35e
Fix g_memdup deprecation warning with glib >= 2.68
...
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-05-05 06:35:56 +01:00
Qiuhao Li
1fae1191e5
reds: fix nullptr deref in red-parse-qxl.cpp
...
At red-parse-qxl.cpp#L535
if (qxl_flags & QXL_BITMAP_DIRECT) {
red->u.bitmap.data = red_get_image_data_flat(slots, group_id,
qxl->bitmap.data,
bitmap_size);
Since qxl->bitmap.data may from the guest, an attacker can make the
memslot_get_virt() check in red_get_image_data_flat() fail and
return a nullptr.
Then at red-parse-qxl.cpp#L550
if (qxl_flags & QXL_BITMAP_UNSTABLE) {
red->u.bitmap.data->flags |= SPICE_CHUNKS_FLAGS_UNSTABLE;
}
qxl_flags is assigned as qxl->bitmap.flags before, which can also be
controlled by the attacker, resulting in a NULL pointer dereference.
This dereference seems to be introduced by commit 5ac88aa7 .
Signed-off-by: Qiuhao Li <Qiuhao.Li@outlook.com>
2021-04-23 06:52:48 +01:00
Rosen Penev
8af176b15e
clang-tidy: use nullptr
...
Found with modernize-use-nullptr
NULL in C++ is 0 whereas it is a void pointer in C. Avoids implicit
conversions.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2021-04-12 06:50:05 +01:00
Rosen Penev
944dc8662e
clang-tidy: use auto
...
Found with modernize-use-auto
auto is shorter and can sometimes disambiguate pointer constness.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-11 07:44:42 +01:00
Rosen Penev
20fa56d75d
clang-tidy: simplify boolean expression
...
Found with readability-simplify-boolean-expr
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-08 16:24:39 +01:00
Rosen Penev
9f1514b804
clang-tidy: use using
...
Found with modernize-use-using
Also manually removed a bunch of typedefs as they are no longer useful
in C++.
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rt-using
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-04-08 16:18:02 +01:00
Frediano Ziglio
4466230a85
red-parse-qxl: Add a note on red_get_cursor
...
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-06-10 10:13:20 +01:00
Frediano Ziglio
e6e6ded681
Use C++ IS-A relationship for RedChannelClient and RedChannel
...
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:08 +01:00