From 6da1d0c50d7c712d35f03b05776bd6dbb37fb17f Mon Sep 17 00:00:00 2001 From: W. Michael Petullo Date: Jan 03 2022 03:43:50 +0000 Subject: Backport patch (upstream commit f95f63c5) that fixes BZ #2036542 and #2014915 Signed-off-by: W. Michael Petullo --- diff --git a/gst-python-1.19.3-int-float.patch b/gst-python-1.19.3-int-float.patch new file mode 100644 index 0000000..74a6486 --- /dev/null +++ b/gst-python-1.19.3-int-float.patch @@ -0,0 +1,70 @@ +diff --git a/gi/overrides/gstmodule.c b/gi/overrides/gstmodule.c +index 167a1c2753..2308eb7dcd 100644 +--- a/gi/overrides/gstmodule.c ++++ b/gi/overrides/gstmodule.c +@@ -104,18 +104,58 @@ gi_gst_fraction_from_value (const GValue * value) + static int + gi_gst_fraction_to_value (GValue * value, PyObject * object) + { +- PyObject *numerator, *denominator; ++ glong numerator, denominator; ++ PyObject *numerator_obj, *denominator_obj, *is_integer; + +- numerator = PyObject_GetAttrString (object, "num"); +- if (numerator == NULL) ++ numerator_obj = PyObject_GetAttrString (object, "num"); ++ if (numerator_obj == NULL) + goto fail; + +- denominator = PyObject_GetAttrString (object, "denom"); +- if (denominator == NULL) ++ is_integer = PyObject_CallMethod (numerator_obj, "is_integer", NULL); ++ if (is_integer != Py_True) { ++ PyErr_Format (PyExc_TypeError, ++ "numerator %f is not an integer.", PyFloat_AsDouble (numerator_obj)); ++ Py_DECREF (is_integer); + goto fail; ++ } ++ Py_DECREF (is_integer); ++ ++ numerator = PyFloat_AsDouble (numerator_obj); ++ if (numerator < -G_MAXINT || numerator > G_MAXINT) { ++ PyErr_Format (PyExc_ValueError, ++ "numerator %" G_GINT64_FORMAT " is out of bound. [-%d - %d]", ++ numerator, G_MAXINT, G_MAXINT); ++ goto fail; ++ } ++ ++ denominator_obj = PyObject_GetAttrString (object, "denom"); ++ if (denominator_obj == NULL) ++ goto fail; ++ ++ is_integer = PyObject_CallMethod (denominator_obj, "is_integer", NULL); ++ if (is_integer != Py_True) { ++ PyErr_Format (PyExc_TypeError, ++ "denominator %f is not an integer.", ++ PyFloat_AsDouble (denominator_obj)); ++ Py_DECREF (is_integer); ++ goto fail; ++ } ++ Py_DECREF (is_integer); ++ ++ denominator = PyFloat_AsDouble (denominator_obj); ++ if (denominator == 0) { ++ PyErr_SetString (PyExc_ValueError, "denominator is 0."); ++ goto fail; ++ } ++ ++ if (denominator < -G_MAXINT || denominator > G_MAXINT) { ++ PyErr_Format (PyExc_ValueError, ++ "denominator %" G_GINT64_FORMAT " is out of bound. [-%d - %d]", ++ denominator, G_MAXINT, G_MAXINT); ++ goto fail; ++ } + +- gst_value_set_fraction (value, +- PyLong_AsLong (numerator), PyLong_AsLong (denominator)); ++ gst_value_set_fraction (value, numerator, denominator); + + return 0; + diff --git a/python-gstreamer1.spec b/python-gstreamer1.spec index 0ff9105..ec2f751 100644 --- a/python-gstreamer1.spec +++ b/python-gstreamer1.spec @@ -2,12 +2,13 @@ Name: python-gstreamer1 Version: 1.19.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Python bindings for GStreamer License: LGPLv2+ URL: http://gstreamer.freedesktop.org/ Source: http://gstreamer.freedesktop.org/src/gst-python/gst-python-%{version}.tar.xz +Patch0: gst-python-1.19.3-int-float.patch BuildRequires: meson >= 0.48.0 BuildRequires: gcc @@ -39,6 +40,7 @@ applications that use GStreamer 1.x in Python 3. %prep %setup -q -n gst-python-%{version} +%patch -p1 find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' @@ -57,6 +59,9 @@ find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %{_libdir}/gstreamer-1.0/libgstpython.*so %changelog +* Sun Jan 02 2022 W. Michael Petullo - 1.19.3-2 +- Backport patch (upstream commit f95f63c5) that fixes BZ #2036542 and #2014915 + * Thu Nov 11 2021 Wim Taymans - 1.19.3-1 - Update to 1.19.3