]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
conditional_ace.idl: Fix undefined shift
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Sun, 26 Nov 2023 23:55:51 +0000 (12:55 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 30 Nov 2023 00:02:33 +0000 (00:02 +0000)
If ‘int’ is a 32‐bit type, then 1 << 31 cannot be represented in an
‘int’, and this shift will invoke undefined behaviour.

We have got away with this so far because of a Pidl bug that changed the
expression to ‘(uint32_t)1 << 31’, which is valid. But that bug is about
to be fixed.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
librpc/idl/conditional_ace.idl

index 60b8966055abebf5bee5e98476a59f042af7e7e9..8db0ed66b7bd8eb38f7b460faf0398d3247e2c49 100644 (file)
@@ -428,7 +428,7 @@ interface conditional_ace
         * operator that argument has been resolved into an ordinary
         * token. So we set the flag so the operator can know.
         */
-       const uint32 CONDITIONAL_ACE_FLAG_TOKEN_FROM_ATTR = 1 << 31;
+       const uint32 CONDITIONAL_ACE_FLAG_TOKEN_FROM_ATTR = UINT32_C(1) << 31;
 
        /*
         * The maximum size of the conditional ACE conditions in the