[OE-core] [oe-core][PATCH 1/1] gnome-desktop3: eliminate erroneous free()
Burton, Ross
ross.burton at intel.com
Tue Mar 6 11:00:21 UTC 2018
Please don't patch a patch, but fix the patch.
Ross
On 6 March 2018 at 00:04, Joe Slater <joe.slater at windriver.com> 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 <joe.slater at windriver.com>
> ---
> .../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 0000000..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 <jslater at windriver.com>
> +
> +
> +--- 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 (&mtime);
> +- if (!tmp_mtime)
> ++ if (!localtime_r (&mtime,&tmp_mtime))
> + goto out;
> +- strftime (mtime_str, 21, "%s", tmp_mtime);
> +- free (tmp_mtime);
> ++
> ++ strftime (mtime_str, 21, "%s", &tmp_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 at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180306/e17c1a94/attachment-0002.html>
More information about the Openembedded-core
mailing list