Re: [OE-core] [oe-core][PATCH 1/1] gnome-desktop3: eliminate erroneous free()

2018-03-06 Thread Burton, Ross
Please don't patch a patch, but fix the patch.

Ross

On 6 March 2018 at 00:04, Joe Slater  wrote:

> gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch introduced
> a call to localtime() and a free() of the structure returned.  This is
> incorrect, as the structure is static.  For glibc 2.26, this will cause
> the program to abort.  Eliminate the free() and call localtime_r()
> which lets us allocate the tm structure.
>
> Signed-off-by: Joe Slater 
> ---
>  .../gnome-desktop/fix_erroneous_free.patch | 35
> ++
>  .../gnome-desktop/gnome-desktop3_3.26.2.bb |  1 +
>  2 files changed, 36 insertions(+)
>  create mode 100644 meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_
> erroneous_free.patch
>
> diff --git 
> a/meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_erroneous_free.patch
> b/meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_erroneous_free.patch
> new file mode 100644
> index 000..c27e4d5
> --- /dev/null
> +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_
> erroneous_free.patch
> @@ -0,0 +1,35 @@
> +gnome-desktop3: eliminate erroneous free()
> +
> +Do not free() a static structure.  Use re-entrant localtime_r().
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Joe Slater 
> +
> +
> +--- a/libgnome-desktop/gnome-desktop-thumbnail.c
>  b/libgnome-desktop/gnome-desktop-thumbnail.c
> +@@ -1200,7 +1200,7 @@ save_thumbnail (GdkPixbuf  *pixbuf,
> +   char *tmp_path = NULL;
> +   int tmp_fd;
> +   char mtime_str[21];
> +-  struct tm *tmp_mtime = NULL;
> ++  struct tm tmp_mtime;
> +   gboolean ret = FALSE;
> +   GError *error = NULL;
> +   const char *width, *height;
> +@@ -1220,11 +1220,10 @@ save_thumbnail (GdkPixbuf  *pixbuf,
> + goto out;
> +   close (tmp_fd);
> +
> +-  tmp_mtime = localtime ();
> +-  if (!tmp_mtime)
> ++  if (!localtime_r (,_mtime))
> + goto out;
> +-  strftime (mtime_str, 21, "%s", tmp_mtime);
> +-  free (tmp_mtime);
> ++
> ++  strftime (mtime_str, 21, "%s", _mtime);
> +   width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
> +   height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
> +
> diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb
> b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb
> index cd6c194..2cd3234 100644
> --- a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb
> +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb
> @@ -14,6 +14,7 @@ SRC_URI += " \
> file://gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch
> \
> file://0001-configure.ac-Remove-gnome-common-macro-calls.patch
> \
> file://0001-Disable-libseccomp-sycall-filtering-mechanism.patch
> \
> +   file://fix_erroneous_free.patch \
> "
>
>  DEPENDS += "intltool-native gsettings-desktop-schemas gconf
> virtual/libx11 gtk+3 glib-2.0 startup-notification xkeyboard-config
> iso-codes udev"
> --
> 2.7.4
>
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [oe-core][PATCH 1/1] gnome-desktop3: eliminate erroneous free()

2018-03-05 Thread Joe Slater
gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch introduced
a call to localtime() and a free() of the structure returned.  This is
incorrect, as the structure is static.  For glibc 2.26, this will cause
the program to abort.  Eliminate the free() and call localtime_r()
which lets us allocate the tm structure.

Signed-off-by: Joe Slater 
---
 .../gnome-desktop/fix_erroneous_free.patch | 35 ++
 .../gnome-desktop/gnome-desktop3_3.26.2.bb |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 
meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_erroneous_free.patch

diff --git 
a/meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_erroneous_free.patch 
b/meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_erroneous_free.patch
new file mode 100644
index 000..c27e4d5
--- /dev/null
+++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop/fix_erroneous_free.patch
@@ -0,0 +1,35 @@
+gnome-desktop3: eliminate erroneous free()
+
+Do not free() a static structure.  Use re-entrant localtime_r().
+
+Upstream-Status: Pending
+
+Signed-off-by: Joe Slater 
+
+
+--- a/libgnome-desktop/gnome-desktop-thumbnail.c
 b/libgnome-desktop/gnome-desktop-thumbnail.c
+@@ -1200,7 +1200,7 @@ save_thumbnail (GdkPixbuf  *pixbuf,
+   char *tmp_path = NULL;
+   int tmp_fd;
+   char mtime_str[21];
+-  struct tm *tmp_mtime = NULL;
++  struct tm tmp_mtime;
+   gboolean ret = FALSE;
+   GError *error = NULL;
+   const char *width, *height;
+@@ -1220,11 +1220,10 @@ save_thumbnail (GdkPixbuf  *pixbuf,
+ goto out;
+   close (tmp_fd);
+ 
+-  tmp_mtime = localtime ();
+-  if (!tmp_mtime)
++  if (!localtime_r (,_mtime))
+ goto out;
+-  strftime (mtime_str, 21, "%s", tmp_mtime);
+-  free (tmp_mtime);
++
++  strftime (mtime_str, 21, "%s", _mtime);
+   width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
+   height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
+ 
diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb 
b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb
index cd6c194..2cd3234 100644
--- a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb
+++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.26.2.bb
@@ -14,6 +14,7 @@ SRC_URI += " \
file://gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch \
file://0001-configure.ac-Remove-gnome-common-macro-calls.patch \
file://0001-Disable-libseccomp-sycall-filtering-mechanism.patch \
+   file://fix_erroneous_free.patch \
"
 
 DEPENDS += "intltool-native gsettings-desktop-schemas gconf virtual/libx11 
gtk+3 glib-2.0 startup-notification xkeyboard-config iso-codes udev"
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core