Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libgusb for openSUSE:Factory checked 
in at 2024-07-19 15:26:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libgusb (Old)
 and      /work/SRC/openSUSE:Factory/.libgusb.new.17339 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libgusb"

Fri Jul 19 15:26:07 2024 rev:28 rq:1188455 version:0.4.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/libgusb/libgusb.changes  2024-03-20 
21:10:16.432973067 +0100
+++ /work/SRC/openSUSE:Factory/.libgusb.new.17339/libgusb.changes       
2024-07-19 15:26:23.760940273 +0200
@@ -1,0 +2,9 @@
+Thu Jul 18 14:26:24 UTC 2024 - Dirk Müller <[email protected]>
+
+- update to 0.4.9:
+  * Allow reading HID descriptors larger than 255 bytes
+  * Close the libusb handle if returning open failure
+  * Fix a buffer over-read when emulating devices
+  * Only request the BOS descriptor when bcdUSB is new enough
+
+-------------------------------------------------------------------

Old:
----
  libgusb-0.4.8.tar.xz

New:
----
  libgusb-0.4.9.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libgusb.spec ++++++
--- /var/tmp/diff_new_pack.lVcSV8/_old  2024-07-19 15:26:24.420966534 +0200
+++ /var/tmp/diff_new_pack.lVcSV8/_new  2024-07-19 15:26:24.424966694 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           libgusb
-Version:        0.4.8
+Version:        0.4.9
 Release:        0
 Summary:        GObject-based library for libusb1
 License:        LGPL-2.1-or-later

++++++ libgusb-0.4.8.tar.xz -> libgusb-0.4.9.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libgusb-0.4.8/.github/workflows/main.yml 
new/libgusb-0.4.9/.github/workflows/main.yml
--- old/libgusb-0.4.8/.github/workflows/main.yml        2023-11-07 
14:08:09.000000000 +0100
+++ new/libgusb-0.4.9/.github/workflows/main.yml        2024-04-22 
16:16:24.000000000 +0200
@@ -21,20 +21,3 @@
       - uses: actions/checkout@v3
       - run: docker build -t libgusb-${{ matrix.distro }} -f 
contrib/ci/Dockerfile-${{ matrix.distro }} .
       - run: docker run -t -v `pwd`:/build libgusb-${{ matrix.distro }} 
./contrib/ci/build_and_test.sh -Dtests=false
-
-  build-freebsd:
-    runs-on: macos-12
-
-    steps:
-    - name: Checkout
-      uses: actions/checkout@v3
-    - name: Build
-      id: test
-      uses: vmactions/[email protected]
-      with:
-        usesh: true
-        mem: 8192
-        prepare: |
-          pkg install -y git python3 glib json-glib meson pkgconf 
gobject-introspection usbids
-        sync: rsync
-        run: ./contrib/ci/build_and_test.sh -Dvapi=false -Ddocs=false 
-Dusb_ids=/usr/local/share/usbids/usb.ids
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libgusb-0.4.8/NEWS new/libgusb-0.4.9/NEWS
--- old/libgusb-0.4.8/NEWS      2023-11-07 14:08:09.000000000 +0100
+++ new/libgusb-0.4.9/NEWS      2024-04-22 16:16:24.000000000 +0200
@@ -1,3 +1,13 @@
+Version 0.4.9
+=============
+Released: 2024-04-22
+
+This release fixes the following bugs:
+ * Allow reading HID descriptors larger than 255 bytes
+ * Close the libusb handle if returning open failure
+ * Fix a buffer over-read when emulating devices
+ * Only request the BOS descriptor when bcdUSB is new enough
+
 Version 0.4.8
 =============
 Released: 2023-11-07
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libgusb-0.4.8/RELEASE.md new/libgusb-0.4.9/RELEASE.md
--- old/libgusb-0.4.8/RELEASE.md        2023-11-07 14:08:09.000000000 +0100
+++ new/libgusb-0.4.9/RELEASE.md        2024-04-22 16:16:24.000000000 +0200
@@ -1,14 +1,14 @@
 GUsb Release Notes
 ==================
 
-git log --format="%s" --cherry-pick --right-only 0.4.7... | grep -i -v trivial 
| grep -v Merge | sort | uniq
+git log --format="%s" --cherry-pick --right-only 0.4.8... | grep -i -v trivial 
| grep -v Merge | sort | uniq
 Add any user visible changes into ../contrib/org.freedesktop.GUsb.metainfo.xml
 appstream-util appdata-to-news ../contrib/org.freedesktop.GUsb.metainfo.xml > 
../NEWS
 
 Update library version if new ABI or API in `meson.build`, commit, and build 
tarball:
 
     # MAKE SURE THIS IS CORRECT
-    export release_ver="0.4.8"
+    export release_ver="0.4.9"
 
     git commit -a -m "Release version ${release_ver}"
     git tag -s -f -m "Release ${release_ver}" "${release_ver}"
@@ -23,15 +23,3 @@
 
     git commit -a -m "trivial: post release version bump"
     git push
-
-Send an email to [email protected]
-
-    =================================================
-    GUsb 0.4.7 released
-
-    GUsb is a GObject wrapper for libusb1 that makes it easy to do
-    asynchronous control, bulk and interrupt transfers with proper
-    cancellation and integration into a mainloop.
-
-    Tarballs available here: https://github.com/hughsie/libgusb/releases
-    =================================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libgusb-0.4.8/contrib/org.freedesktop.GUsb.metainfo.xml 
new/libgusb-0.4.9/contrib/org.freedesktop.GUsb.metainfo.xml
--- old/libgusb-0.4.8/contrib/org.freedesktop.GUsb.metainfo.xml 2023-11-07 
14:08:09.000000000 +0100
+++ new/libgusb-0.4.9/contrib/org.freedesktop.GUsb.metainfo.xml 2024-04-22 
16:16:24.000000000 +0200
@@ -21,6 +21,17 @@
     <binary>gusbcmd</binary>
   </provides>
   <releases>
+    <release version="0.4.9" date="2024-04-22">
+      <description>
+        <p>This release fixes the following bugs:</p>
+        <ul>
+          <li>Allow reading HID descriptors larger than 255 bytes</li>
+          <li>Close the libusb handle if returning open failure</li>
+          <li>Fix a buffer over-read when emulating devices</li>
+          <li>Only request the BOS descriptor when bcdUSB is new enough</li>
+        </ul>
+      </description>
+    </release>
     <release version="0.4.8" date="2023-11-07">
       <description>
         <p>This release adds the following feature:</p>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libgusb-0.4.8/gusb/gusb-device.c 
new/libgusb-0.4.9/gusb/gusb-device.c
--- old/libgusb-0.4.8/gusb/gusb-device.c        2023-11-07 14:08:09.000000000 
+0100
+++ new/libgusb-0.4.9/gusb/gusb-device.c        2024-04-22 16:16:24.000000000 
+0200
@@ -323,11 +323,11 @@
                for (guint i = 0; i < json_array_get_length(json_array); i++) {
                        JsonNode *node_tmp = json_array_get_element(json_array, 
i);
                        JsonObject *obj_tmp = json_node_get_object(node_tmp);
-                       g_autoptr(GUsbInterface) interface =
+                       g_autoptr(GUsbInterface) iface =
                            g_object_new(G_USB_TYPE_INTERFACE, NULL);
-                       if (!_g_usb_interface_load(interface, obj_tmp, error))
+                       if (!_g_usb_interface_load(iface, obj_tmp, error))
                                return FALSE;
-                       g_ptr_array_add(priv->interfaces, 
g_object_ref(interface));
+                       g_ptr_array_add(priv->interfaces, g_object_ref(iface));
                }
        }
 
@@ -485,8 +485,8 @@
                json_builder_set_member_name(json_builder, "UsbInterfaces");
                json_builder_begin_array(json_builder);
                for (guint i = 0; i < interfaces->len; i++) {
-                       GUsbInterface *interface = 
g_ptr_array_index(interfaces, i);
-                       if (!_g_usb_interface_save(interface, json_builder, 
error))
+                       GUsbInterface *iface = g_ptr_array_index(interfaces, i);
+                       if (!_g_usb_interface_save(iface, json_builder, error))
                                return FALSE;
                }
                json_builder_end_array(json_builder);
@@ -863,7 +863,15 @@
 
        /* open device */
        rc = libusb_open(priv->device, &priv->handle);
-       return g_usb_device_libusb_error_to_gerror(self, rc, error);
+       if (!g_usb_device_libusb_error_to_gerror(self, rc, error)) {
+               if (priv->handle != NULL)
+                       libusb_close(priv->handle);
+               priv->handle = NULL;
+               return FALSE;
+       }
+
+       /* success */
+       return TRUE;
 }
 
 /**
@@ -1093,14 +1101,14 @@
        if (interfaces == NULL)
                return NULL;
        for (guint i = 0; i < interfaces->len; i++) {
-               GUsbInterface *interface = g_ptr_array_index(interfaces, i);
-               if (g_usb_interface_get_class(interface) != class_id)
+               GUsbInterface *iface = g_ptr_array_index(interfaces, i);
+               if (g_usb_interface_get_class(iface) != class_id)
                        continue;
-               if (g_usb_interface_get_subclass(interface) != subclass_id)
+               if (g_usb_interface_get_subclass(iface) != subclass_id)
                        continue;
-               if (g_usb_interface_get_protocol(interface) != protocol_id)
+               if (g_usb_interface_get_protocol(iface) != protocol_id)
                        continue;
-               return g_object_ref(interface);
+               return g_object_ref(iface);
        }
 
        /* nothing matched */
@@ -1160,8 +1168,8 @@
                        for (guint j = 0; j < 
(guint)config->interface[i].num_altsetting; j++) {
                                const struct libusb_interface_descriptor *ifp =
                                    &config->interface[i].altsetting[j];
-                               GUsbInterface *interface = 
_g_usb_interface_new(ifp);
-                               g_ptr_array_add(priv->interfaces, interface);
+                               GUsbInterface *iface = 
_g_usb_interface_new(ifp);
+                               g_ptr_array_add(priv->interfaces, iface);
                        }
                }
                libusb_free_config_descriptor(config);
@@ -1311,6 +1319,14 @@
                        g_usb_device_not_open_error(self, error);
                        return NULL;
                }
+               if (g_usb_device_get_spec(self) <= 0x0200) {
+                       g_set_error(error,
+                                   G_IO_ERROR,
+                                   G_IO_ERROR_NOT_SUPPORTED,
+                                   "not available as bcdUSB 0x%04x <= 0x0200",
+                                   g_usb_device_get_spec(self));
+                       return NULL;
+               }
 
                rc = libusb_get_bos_descriptor(priv->handle, &bos);
                if (!g_usb_device_libusb_error_to_gerror(self, rc, error))
@@ -1343,6 +1359,7 @@
        const guint8 *buf;
        gsize actual_length = 0;
        gsize buf2sz;
+       guint16 buf2szle = 0;
        g_autofree guint8 *buf2 = NULL;
 
        extra = g_usb_interface_get_extra(intf);
@@ -1373,7 +1390,9 @@
                            (guint)LIBUSB_DT_HID);
                return NULL;
        }
-       if (buf[7] == 0) {
+       memcpy(&buf2szle, buf + 7, sizeof(buf2szle));
+       buf2sz = GUINT16_FROM_LE(buf2szle);
+       if (buf2sz == 0) {
                g_set_error(error,
                            G_IO_ERROR,
                            G_IO_ERROR_NOT_FOUND,
@@ -1381,8 +1400,9 @@
                            g_usb_interface_get_number(intf));
                return NULL;
        }
-       buf2sz = buf[7];
-       g_debug("get 0x%x bytes of HID descriptor", (guint)buf2sz);
+       g_debug("get 0x%x bytes of HID descriptor on iface 0x%x",
+               (guint)buf2sz,
+               g_usb_interface_get_number(intf));
 
        /* get HID descriptor */
        buf2 = g_malloc0(buf2sz);
@@ -1671,7 +1691,7 @@
 /**
  * g_usb_device_claim_interface:
  * @self: a #GUsbDevice
- * @interface: bInterfaceNumber of the interface you wish to claim
+ * @iface: bInterfaceNumber of the interface you wish to claim
  * @flags: #GUsbDeviceClaimInterfaceFlags
  * @error: a #GError, or %NULL
  *
@@ -1683,7 +1703,7 @@
  **/
 gboolean
 g_usb_device_claim_interface(GUsbDevice *self,
-                            gint interface,
+                            gint iface,
                             GUsbDeviceClaimInterfaceFlags flags,
                             GError **error)
 {
@@ -1701,21 +1721,21 @@
                return g_usb_device_not_open_error(self, error);
 
        if (flags & G_USB_DEVICE_CLAIM_INTERFACE_BIND_KERNEL_DRIVER) {
-               rc = libusb_detach_kernel_driver(priv->handle, interface);
+               rc = libusb_detach_kernel_driver(priv->handle, iface);
                if (rc != LIBUSB_SUCCESS && rc != LIBUSB_ERROR_NOT_FOUND && /* 
No driver attached */
                    rc != LIBUSB_ERROR_NOT_SUPPORTED &&                     /* 
win32 */
                    rc != LIBUSB_ERROR_BUSY /* driver rebound already */)
                        return g_usb_device_libusb_error_to_gerror(self, rc, 
error);
        }
 
-       rc = libusb_claim_interface(priv->handle, interface);
+       rc = libusb_claim_interface(priv->handle, iface);
        return g_usb_device_libusb_error_to_gerror(self, rc, error);
 }
 
 /**
  * g_usb_device_release_interface:
  * @self: a #GUsbDevice
- * @interface: bInterfaceNumber of the interface you wish to release
+ * @iface: bInterfaceNumber of the interface you wish to release
  * @flags: #GUsbDeviceClaimInterfaceFlags
  * @error: a #GError, or %NULL
  *
@@ -1727,7 +1747,7 @@
  **/
 gboolean
 g_usb_device_release_interface(GUsbDevice *self,
-                              gint interface,
+                              gint iface,
                               GUsbDeviceClaimInterfaceFlags flags,
                               GError **error)
 {
@@ -1744,12 +1764,12 @@
        if (priv->handle == NULL)
                return g_usb_device_not_open_error(self, error);
 
-       rc = libusb_release_interface(priv->handle, interface);
+       rc = libusb_release_interface(priv->handle, iface);
        if (rc != LIBUSB_SUCCESS)
                return g_usb_device_libusb_error_to_gerror(self, rc, error);
 
        if (flags & G_USB_DEVICE_CLAIM_INTERFACE_BIND_KERNEL_DRIVER) {
-               rc = libusb_attach_kernel_driver(priv->handle, interface);
+               rc = libusb_attach_kernel_driver(priv->handle, iface);
                if (rc != LIBUSB_SUCCESS && rc != LIBUSB_ERROR_NOT_FOUND && /* 
No driver attached */
                    rc != LIBUSB_ERROR_NOT_SUPPORTED &&                     /* 
win32 */
                    rc != LIBUSB_ERROR_BUSY /* driver rebound already */)
@@ -1762,7 +1782,7 @@
 /**
  * g_usb_device_set_interface_alt:
  * @self: a #GUsbDevice
- * @interface: bInterfaceNumber of the interface you wish to release
+ * @iface: bInterfaceNumber of the interface you wish to release
  * @alt: alternative setting number
  * @error: a #GError, or %NULL
  *
@@ -1773,7 +1793,7 @@
  * Since: 0.2.8
  **/
 gboolean
-g_usb_device_set_interface_alt(GUsbDevice *self, gint interface, guint8 alt, 
GError **error)
+g_usb_device_set_interface_alt(GUsbDevice *self, gint iface, guint8 alt, 
GError **error)
 {
        GUsbDevicePrivate *priv = GET_PRIVATE(self);
        gint rc;
@@ -1788,7 +1808,7 @@
        if (priv->handle == NULL)
                return g_usb_device_not_open_error(self, error);
 
-       rc = libusb_set_interface_alt_setting(priv->handle, interface, 
(gint)alt);
+       rc = libusb_set_interface_alt_setting(priv->handle, iface, (gint)alt);
        if (rc != LIBUSB_SUCCESS)
                return g_usb_device_libusb_error_to_gerror(self, rc, error);
 
@@ -2329,6 +2349,7 @@
        g_object_unref(task);
 }
 
+/* copy @dstsz bytes of @bytes into @dst */
 static gboolean
 gusb_memcpy_bytes_safe(guint8 *dst, gsize dstsz, GBytes *bytes, GError **error)
 {
@@ -2345,11 +2366,11 @@
        }
 
        /* data is the same */
-       if (memcmp(dst, g_bytes_get_data(bytes, NULL), dstsz) == 0)
+       if (memcmp(dst, g_bytes_get_data(bytes, NULL), g_bytes_get_size(bytes)) 
== 0)
                return TRUE;
 
        /* if this explodes it's because the caller has cast an immutable 
buffer to a guint8* */
-       memcpy(dst, g_bytes_get_data(bytes, NULL), dstsz);
+       memcpy(dst, g_bytes_get_data(bytes, NULL), g_bytes_get_size(bytes));
        return TRUE;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libgusb-0.4.8/gusb/gusb-device.h 
new/libgusb-0.4.9/gusb/gusb-device.h
--- old/libgusb-0.4.8/gusb/gusb-device.h        2023-11-07 14:08:09.000000000 
+0100
+++ new/libgusb-0.4.9/gusb/gusb-device.h        2024-04-22 16:16:24.000000000 
+0200
@@ -252,16 +252,16 @@
 
 gboolean
 g_usb_device_claim_interface(GUsbDevice *self,
-                            gint interface,
+                            gint iface,
                             GUsbDeviceClaimInterfaceFlags flags,
                             GError **error);
 gboolean
 g_usb_device_release_interface(GUsbDevice *self,
-                              gint interface,
+                              gint iface,
                               GUsbDeviceClaimInterfaceFlags flags,
                               GError **error);
 gboolean
-g_usb_device_set_interface_alt(GUsbDevice *self, gint interface, guint8 alt, 
GError **error);
+g_usb_device_set_interface_alt(GUsbDevice *self, gint iface, guint8 alt, 
GError **error);
 
 gchar *
 g_usb_device_get_string_descriptor(GUsbDevice *self, guint8 desc_index, GError 
**error);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libgusb-0.4.8/meson.build 
new/libgusb-0.4.9/meson.build
--- old/libgusb-0.4.8/meson.build       2023-11-07 14:08:09.000000000 +0100
+++ new/libgusb-0.4.9/meson.build       2024-04-22 16:16:24.000000000 +0200
@@ -1,5 +1,5 @@
 project('libgusb', 'c',
-  version : '0.4.8',
+  version : '0.4.9',
   license : 'LGPL-2.1+',
   meson_version : '>=0.56.0',
   default_options : ['c_std=c99']
@@ -124,6 +124,10 @@
   libjsonglib,
 ]
 
+if not get_option('introspection') and get_option('vapi')
+  error('-Dvapi=true requires -Dintrospection=true')
+endif
+
 gnome = import('gnome')
 
 add_project_arguments('-DGUSB_COMPILATION', language: 'c')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libgusb-0.4.8/tools/gusb-main.c 
new/libgusb-0.4.9/tools/gusb-main.c
--- old/libgusb-0.4.8/tools/gusb-main.c 2023-11-07 14:08:09.000000000 +0100
+++ new/libgusb-0.4.9/tools/gusb-main.c 2024-04-22 16:16:24.000000000 +0200
@@ -357,12 +357,8 @@
 static gboolean
 gusb_cmd_load(GUsbCmdPrivate *priv, gchar **values, GError **error)
 {
-       JsonObject *json_obj;
-       JsonNode *json_node;
-       g_autoptr(JsonParser) parser = json_parser_new();
-
        /* check args */
-       if (g_strv_length(values) != 1) {
+       if (g_strv_length(values) == 0) {
                g_set_error_literal(error,
                                    G_IO_ERROR,
                                    G_IO_ERROR_INVALID_ARGUMENT,
@@ -370,24 +366,30 @@
                return FALSE;
        }
 
-       /* parse */
-       if (!json_parser_load_from_file(parser, values[0], error))
-               return FALSE;
+       for (guint i = 0; values[i] != NULL; i++) {
+               JsonObject *json_obj;
+               JsonNode *json_node;
+               g_autoptr(JsonParser) parser = json_parser_new();
 
-       /* sanity check */
-       json_node = json_parser_get_root(parser);
-       if (!JSON_NODE_HOLDS_OBJECT(json_node)) {
-               g_set_error_literal(error,
-                                   G_IO_ERROR,
-                                   G_IO_ERROR_INVALID_DATA,
-                                   "not a JSON object");
-               return FALSE;
-       }
+               /* parse */
+               if (!json_parser_load_from_file(parser, values[i], error))
+                       return FALSE;
 
-       /* not supplied */
-       json_obj = json_node_get_object(json_node);
-       if (!g_usb_context_load(priv->usb_ctx, json_obj, error))
-               return FALSE;
+               /* sanity check */
+               json_node = json_parser_get_root(parser);
+               if (!JSON_NODE_HOLDS_OBJECT(json_node)) {
+                       g_set_error_literal(error,
+                                           G_IO_ERROR,
+                                           G_IO_ERROR_INVALID_DATA,
+                                           "not a JSON object");
+                       return FALSE;
+               }
+
+               /* not supplied */
+               json_obj = json_node_get_object(json_node);
+               if (!g_usb_context_load(priv->usb_ctx, json_obj, error))
+                       return FALSE;
+       }
 
        /* success */
        return gusb_cmd_show(priv, NULL, error);

Reply via email to