Commit Graph
13 Commits
Author SHA1 Message Date
Chris c8474c515c Avoid signed overflow in bs_read_se() (#2071)
bs_read_ue() can return values above INT32_MAX. bs_read_se() stored the
result in an int32_t and computed (r+1)/2, which is undefined behavior
when the code is 0x7FFFFFFF and gives wrong values for codes above
INT32_MAX. The SPS being parsed comes from the host during the H.264
SPS fixup.

Do the conversion in unsigned arithmetic. bs_read_ue() returns at most
0xFFFFFFFE, so both branches produce in-range int32_t values, and every
code that was previously well-defined decodes to the same value.
2026-10-24 18:17:00 -05:00
Cameron Gutman 9b8886a6f5 Fix integer truncation warning on MSVC 2026-10-19 00:15:26 -05:00
Cameron Gutman 289782c6f3 Fix possible UB shift in bs_write_u() for large values of n 2026-10-14 01:51:15 -05:00
Cameron Gutman fa6ae80940 Clamp additional values that can be used as array indices
These aren't exploitable in moonlight due to clamping done on the read side.
2026-10-14 01:09:54 -05:00
Cameron Gutman 71c3191e0c Remove warn_off for h264bitstream 2026-10-12 02:31:48 -05:00
Cameron Gutman a57e947d71 Re-add the h264bitstream file headers mistakenly removed during vendoring 2026-10-07 20:19:06 -05:00
Cameron Gutman 7794a42843 Fix C4146 warning on MSVC 2026-07-26 20:12:58 -05:00
Cameron Gutman 3e24a7a1a5 Fix several bugs in h264bitstream 2026-07-26 19:23:34 -05:00
Cameron Gutman b7adc70ea4 Import minimal set of code from h264bitstream needed for SPS fixups 2026-07-26 19:23:34 -05:00
Cameron Gutman a243c6bb90 Don't build unneeded sources
Fixes #1010
2023-07-09 17:23:21 -05:00
Cameron Gutman 67b0907e52 Add globaldefs.pri for setting qmake values in each project 2019-04-21 11:08:33 -07:00
Cameron Gutman 5df2704ccc Compile h264bitstream as GNU99 on GCC 2018-10-12 21:45:41 -07:00
Cameron Gutman 4f84843b00 Fixup H.264 SPS for VideoToolbox compatibility. Fixes #98 2018-10-12 17:59:53 -07:00