Commit 04c02418 authored by Icecream95's avatar Icecream95 Committed by Marge Bot
Browse files

pan/decode: Avoid undefined behaviour on shift in bits()

v2: Return 0 instead of `word` (Alyssa)

Part-of: <mesa/mesa!11869>
parent 66427494
......@@ -451,6 +451,9 @@ bits(u32 word, u32 lo, u32 hi)
if (hi - lo >= 32)
return word; // avoid undefined behavior with the shift
if (lo >= 32)
return 0;
return (word >> lo) & ((1 << (hi - lo)) - 1);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment