The type of the result of a shift operation is unaffected by the type of
the right operand, so some existing code overflows with undefined behaviour
when the element length is 32. Add a helper macro to calculate the maximum
value correctly and then use it everywhere this pattern appears.
Found-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
* commit 'eccc03c8fbc603a0a3257df66f0705f74fe2581a':
cbs_h264: Add support for filler NAL units
Some bitstream -> get_bits.
Merged-by: Mark Thompson <sw@jkqxz.net>
* commit '13ca5d34ba5c473211daaae0a101123bcaada3e6':
cbs_h264: Add hack for pic_timing with no active SPS
Partially fixes#6896 - the sample stream from that ticket now works, but
more obscure cases can still fail.
Merged-by: Mark Thompson <sw@jkqxz.net>
(cherry picked from commit acf06f45441be24c5cbae0920579cd69427326a1)
(cherry picked from commit 768eb9182e94a94bc2ef46f565a0dac7afef3b57)
(cherry picked from commit e7f64191b27bcf37cbf7006606f0f439c6cdc24f)