diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-04-07 18:57:41 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-04-07 18:57:41 +0300 |
commit | c54d42aed3e104c120540498d3f8c7f39203a515 (patch) | |
tree | c5eb25ccb1a1ee52887fe5e3a492eec95fba0e7e | |
parent | 0b8c423cde1e137dfef534d1aa4a210926136c0f (diff) | |
download | orc-c54d42aed3e104c120540498d3f8c7f39203a515.tar.gz |
orcarm: Fix undefined behaviour
Left-shift of a negative signed integer is undefined behaviour. The
value becomes negative because bitwise-not on a positive, signed integer
results in a negative signed integer.
To solve this use unsigned integers. The code assumes that the sign bit
is not treated differently from any other bits.
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>
-rw-r--r-- | orc/orcarm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/orc/orcarm.c b/orc/orcarm.c index 21933d4..2080392 100644 --- a/orc/orcarm.c +++ b/orc/orcarm.c @@ -1230,7 +1230,7 @@ count_leading_zeros (orc_uint64 val) * 64-bit variant: N:immr:imms */ static int -encode_logical_imm (int size, orc_uint64 val, orc_uint32 *encoded) +encode_logical_imm (unsigned int size, orc_uint64 val, orc_uint32 *encoded) { orc_uint64 mask; orc_uint32 I, CTO, CLO; |