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 762748 - Undefined behavior
Undefined behavior
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-02-26 18:02 UTC by Matthias Clasen
Modified: 2016-03-01 15:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GDBusConnection: use uint for bitshifts (1.08 KB, patch)
2016-02-29 14:36 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Matthias Clasen 2016-02-26 18:02:36 UTC
gcc's --fsanitize=undefined flags these when running make check:

gparam.c:472:27: runtime error: left shift of negative value -1
gdbusconnection.c:2603:51: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
gdbusconnection.c:5888:17: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
gdbusconnection.c:5927:15: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
gdbusconnection.c:5928:19: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
gdbusconnection.c:1611:33: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
Comment 1 Allison Karlitskaya (desrt) 2016-02-29 14:36:43 UTC
Created attachment 322662 [details] [review]
GDBusConnection: use uint for bitshifts

"1 << 31" is not well-defined, do use "1u << 31" instead.
Comment 2 Matthias Clasen 2016-02-29 15:58:11 UTC
Review of attachment 322662 [details] [review]:

yeah, looks right
Comment 3 Allison Karlitskaya (desrt) 2016-03-01 15:36:20 UTC
Attachment 322662 [details] pushed as b54acf5 - GDBusConnection: use uint for bitshifts