[gnome-settings-daemon/wip/claudio/CI] power: Add memory sanitization workaround to power enums helper



commit 69c868aedd579556533abf5b8d3c3c5dd564b41f
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Feb 5 19:07:16 2019 +0100

    power: Add memory sanitization workaround to power enums helper
    
    For some reason we get an error when calling g_print. This works around
    the following build error:
    
    Uninitialized bytes in __interceptor_fopen64 at offset 3 inside [0x702000000160, 18)
    ==30133==WARNING: MemorySanitizer: use-of-uninitialized-value
        #0 0x7f9e3205ab75 in _g_locale_get_charset_aliases.part.0 
/home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/libcharset/localcharset.c:141:38
        #1 0x7f9e3205afc4 in _g_locale_get_charset_aliases 
/home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/libcharset/localcharset.c:448:3
        #2 0x7f9e3205afc4 in _g_locale_charset_unalias 
/home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/libcharset/localcharset.c:448:18
        #3 0x7f9e31feb569 in g_utf8_get_charset_internal 
/home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/gcharset.c:119:13
        #4 0x7f9e31feb569 in g_get_charset 
/home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/gcharset.c:204:24
        #5 0x7f9e3201a007 in g_print 
/home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/gmessages.c:3189:11
        #6 0x494488 in output_flags_values 
/home/benjamin/Projects/jhbuild/checkout/gnome-settings-daemon/_build/../plugins/power/gsd-power-enums-update.c:26:3
        #7 0x49432a in main 
/home/benjamin/Projects/jhbuild/checkout/gnome-settings-daemon/_build/../plugins/power/gsd-power-enums-update.c:41:2
        #8 0x7f9e31bb4412 in __libc_start_main (/lib64/libc.so.6+0x24412)
        #9 0x41b33d in _start 
(/home/benjamin/Projects/jhbuild/checkout/gnome-settings-daemon/_build/plugins/power/gsd-power-enums-update+0x41b33d)

 plugins/power/gsd-power-enums-update.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/plugins/power/gsd-power-enums-update.c b/plugins/power/gsd-power-enums-update.c
index bdc4e050..b44aa964 100644
--- a/plugins/power/gsd-power-enums-update.c
+++ b/plugins/power/gsd-power-enums-update.c
@@ -30,6 +30,12 @@ output_flags_values (GType class_type)
 int
 main (int argc, char **argv)
 {
+       /* XXX: This is a bad workaround for the fact that the g_print calls
+        *      cause some checks to fail when running the clang memory
+        *      sanitizer.
+        */
+       g_setenv ("CHARSET", "UTF-8", TRUE);
+
        g_type_class_ref (GSD_POWER_TYPE_INHIBITOR_FLAG);
        g_type_class_ref (GSD_POWER_TYPE_PRESENCE_STATUS);
        output_flags_values (GSD_POWER_TYPE_INHIBITOR_FLAG);


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