[gnome-remote-desktop] Change all g_memdup() to g_memdup2()



commit c23cd085ca2cbb4f4343288a367947186cccfa49
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Feb 4 19:19:37 2021 +0100

    Change all g_memdup() to g_memdup2()
    
    Using g_memdup() is dangerous due to the type of the size argument. See
    https://gitlab.gnome.org/GNOME/glib/-/issues/2319 and
    https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1926 for details.

 .gitlab-ci.yml                      | 11 ++++++++---
 .gitlab-ci/install-meson-project.sh | 39 +++++++++++++++++++++++++++++++++++++
 .gitlab-ci/run-tests.sh             |  1 +
 src/grd-rdp-pipewire-stream.c       |  4 ++--
 4 files changed, 50 insertions(+), 5 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 10bfe60..d6b1b43 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ stages:
 .gnome-remote-desktop.fedora:33@common:
   variables:
     FDO_DISTRIBUTION_VERSION: 33
-    BASE_TAG: '2020-12-18.0'
+    BASE_TAG: '2021-02-04.0'
     FDO_UPSTREAM_REPO: GNOME/gnome-remote-desktop
     FDO_DISTRIBUTION_EXEC: |
       dnf -y update && dnf -y upgrade &&
@@ -28,6 +28,13 @@ stages:
                      python3-gobject gnome-settings-daemon mesa-dri-drivers \
                      xorg-x11-server-Xwayland mutter &&
 
+      # To build glib
+      dnf builddep -y glib2 --setopt=install_weak_deps=False &&
+
+      ./.gitlab-ci/install-meson-project.sh \
+          https://gitlab.gnome.org/GNOME/glib.git \
+          2.67.3 . &&
+
       dnf clean all
 
 .gnome-remote-desktop.fedora:33@x86_64:
@@ -84,8 +91,6 @@ test-gnome-remote-desktop:
   script:
     - mkdir -m 700 $XDG_RUNTIME_DIR
     - glib-compile-schemas $GSETTINGS_SCHEMA_DIR
-    - sed -i 's/.*module-rtkit.*/# &/' /etc/pipewire/pipewire.conf
-    - sed -i 's/exec pipewire-media-session .*/exec pipewire-media-session -d bluez5,alsa-seq,alsa-pcm/' 
/etc/pipewire/pipewire.conf
     - dbus-run-session -- ./.gitlab-ci/run-tests.sh
   needs:
     - build-gnome-remote-desktop
diff --git a/.gitlab-ci/install-meson-project.sh b/.gitlab-ci/install-meson-project.sh
new file mode 100755
index 0000000..575410b
--- /dev/null
+++ b/.gitlab-ci/install-meson-project.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+set -e
+
+if [[ $# -lt 3 ]]; then
+  echo Usage: $0 [options] [repo-url] [commit] [subdir]
+  echo  Options:
+  echo    -Dkey=val
+  exit 1
+fi
+
+MESON_OPTIONS=()
+
+while [[ $1 =~ ^-D ]]; do
+  MESON_OPTIONS+=( "$1" )
+  shift
+done
+
+REPO_URL="$1"
+TAG_OR_BRANCH="$2"
+SUBDIR="$3"
+COMMIT="$4"
+
+REPO_DIR="$(basename ${REPO_URL%.git})"
+
+git clone --depth 1 "$REPO_URL" -b "$TAG_OR_BRANCH"
+pushd "$REPO_DIR"
+pushd "$SUBDIR"
+
+if [ ! -z "$COMMIT" ]; then
+  git fetch origin "$COMMIT"
+  git checkout "$COMMIT"
+fi
+
+meson --prefix=/usr _build "${MESON_OPTIONS[@]}"
+ninja -C _build install
+popd
+popd
+rm -rf "$REPO_DIR"
diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh
index 6c8f930..ccd5443 100755
--- a/.gitlab-ci/run-tests.sh
+++ b/.gitlab-ci/run-tests.sh
@@ -1,3 +1,4 @@
 #!/bin/sh
+set -x
 pipewire &
 meson test -C build --no-rebuild --verbose --no-stdsplit -t 10
diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c
index 5f62267..b99d795 100644
--- a/src/grd-rdp-pipewire-stream.c
+++ b/src/grd-rdp-pipewire-stream.c
@@ -366,8 +366,8 @@ process_buffer (GrdRdpPipeWireStream *stream,
           uint8_t *buf;
 
           buf = SPA_MEMBER (spa_meta_bitmap, spa_meta_bitmap->offset, uint8_t);
-          frame->pointer_bitmap = g_memdup (buf, spa_meta_bitmap->size.height *
-                                                 spa_meta_bitmap->stride);
+          frame->pointer_bitmap = g_memdup2 (buf, spa_meta_bitmap->size.height *
+                                                  spa_meta_bitmap->stride);
           frame->pointer_hotspot_x = spa_meta_cursor->hotspot.x;
           frame->pointer_hotspot_y = spa_meta_cursor->hotspot.y;
           frame->pointer_width = spa_meta_bitmap->size.width;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]