]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:fuzzing: Fix undefined shift
authorJo Sutton <josutton@catalyst.net.nz>
Tue, 14 May 2024 04:42:31 +0000 (16:42 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 16 May 2024 02:11:36 +0000 (02:11 +0000)
../../lib/fuzzing/fuzz_stable_sort_r_unstable.c:47:22: runtime error: left shift of negative value -34

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/fuzzing/fuzz_stable_sort_r_unstable.c

index bf25b3e29b54363fa774ff37bcb2e44bd5fc4d4a..45abc6a535c868117139abdca81eee332c213f29 100644 (file)
@@ -44,7 +44,7 @@ static int cmp_int8(int8_t *_a, int8_t *_b, int8_t *ctx)
                /* aim for sustained chaos. */
                c += a;
                c ^= b;
-               c ^= (c >> 5) + (c << 3);
+               c ^= (c >> 5) + ((uint8_t)c << 3);
                *ctx = (c + 99) | 1;
        }
        switch((c >> 1) & 7) {