mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-10-26 22:10:56 +00:00
Fix possible UB shift in bs_write_u() for large values of n
This commit is contained in:
1 parent
ee557e83c6
commit
289782c6f3
1 file changed
+1
-1
+1
-1
@@ -208,7 +208,7 @@ static inline void bs_write_u(bs_t* b, int n, uint32_t v)
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
bs_write_u1(b, (v >> ( n - i - 1 ))&0x01 );
|
||||
bs_write_u1(b, (n - i - 1 >= 32) ? 0 : ((v >> ( n - i - 1 ))&0x01) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user