• Andreas Rheinhardt's avatar
    cbs_h2645: Fix infinite loop in more_rbsp_data · d4035ca8
    Andreas Rheinhardt authored
    cbs_h2645_read_more_rbsp_data does not handle malformed input very well:
    1. If there were <= 8 bits left in the bitreader, these bits were read
    via show_bits. But show_bits requires the number of bits to be read to
    be > 0 (internally it shifts by 32 - number of bits to be read which is
    undefined behaviour if said number is zero; there is also an assert for
    this, but it is only an av_assert2). Furthermore, in this case a shift
    by -1 was performed which is of course undefined behaviour, too.
    2. If there were > 0 and <= 8 bits left and all of them were zero
    (this can only happen for defective input), it was reported that there
    was further RBSP data.
    
    This can lead to an infinite loop in H.265's cbs_h265_read_extension_data
    corresponding to the [vsp]ps_extension_data_flag syntax elements. If the
    relevant flag indicates the (potential) occurence of these syntax elements,
    while all bits after this flag are zero, cbs_h2645_read_more_rbsp_data
    always returns 1 on x86. Given that a checked bitstream reader is used,
    we are also not "saved" by an overflow in the bitstream reader's index.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    d4035ca8
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...