broadband-modem: fix a undifined behavior
. A shift has undefined behaviour if the mathematical result
(lhs * 2^{rhs}) doesn't fit in the range of the resulting type.
In other words, you can't left shift into the sign bit of a
signed integer type.
The error message is:
mm-broadband-modem.c:3308:15: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
SUMMARY: AddressSanitizer: undefined-behavior mm-broadband-modem.c:3308:15 in
This commit is contained in:
committed by
Aleksander Morgado
parent
30cbf7202c
commit
4e00558fcb
@@ -3315,7 +3315,7 @@ get_next_facility_lock_status (LoadEnabledFacilityLocksContext *ctx)
|
||||
guint i;
|
||||
|
||||
for (i = ctx->current; i < sizeof (MMModem3gppFacility) * 8; i++) {
|
||||
guint32 facility = 1 << i;
|
||||
guint32 facility = 1u << i;
|
||||
|
||||
/* Found the next one to query! */
|
||||
if (ctx->facilities & facility) {
|
||||
|
||||
Reference in New Issue
Block a user