After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 729267 - Build failure: mm-modem-messaging.c:168:24: error: 'array' may be used uninitialized in this function
Build failure: mm-modem-messaging.c:168:24: error: 'array' may be used uninit...
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: ModemManager
git master
Other Linux
: Normal major
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-04-30 13:56 UTC by Martin Pitt
Modified: 2014-05-05 18:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple fix (1.21 KB, patch)
2014-04-30 13:59 UTC, Martin Pitt
committed Details | Review

Description Martin Pitt 2014-04-30 13:56:57 UTC
When building ModemManager with -O3, you get the following failure:

mm-modem-messaging.c: In function 'mm_modem_messaging_get_supported_storages':
mm-modem-messaging.c:168:24: error: 'array' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     *n_storages = array->len;
                        ^
cc1: all warnings being treated as errors
make[3]: *** [libmm_glib_la-mm-modem-messaging.lo] Error 1

That function does:

    GArray *array;
    [...]
    ensure_internal_supported_storages (self, &array);
    if (!array)
        return FALSE;
    *n_storages = array->len;

and ensure_internal_supported_storages() does

        if (dup && self->priv->supported_storages)
            *dup = g_array_ref (self->priv->supported_storages);

So nowhere array gets initialized to NULL. So this is indeed a potential crasher if it gets init'ed to some garbage and then ensure_internal_supported_storages() tries to write into it.
Comment 1 Martin Pitt 2014-04-30 13:59:49 UTC
Created attachment 275490 [details] [review]
Simple fix

git-formatted patch against current master.
Comment 2 Aleksander Morgado 2014-05-05 18:51:36 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.