Closed Gnurou closed 4 months ago
@bgrzesik I am mostly interested in your feedback for the first CL since it touches the encoder, but please feel free to look at the rest as this is the global direction I would like to move all the parsers towards (i.e. limit the range of read data to prevent runtime panics even with random or forged input).
For the encoder side, I wonder whether we should not make some of the builder methods fallible if their input would result in a potentially panicking SPS. Actually I think we should do this, but would like your thoughts before proceeding.
A set of small changes that restrict the data types and valid ranges of some SPS parameters to make sure we don't get runtime panics due to overflows when processing invalid data.
Some of these problems have been revealed by fuzzing, some others are just drive-by improvements, notably those that move pre-computed values into methods to remove the possibility of inconsistencies and better align with the spec.