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 '13ca5d34ba':
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>