[FFmpeg-devel] [PATCH 2/3] vorbisdec: replace get_bits with get_bitsz where n can be 0
Michael Niedermayer
michael at niedermayer.cc
Sun Jan 3 02:41:52 CET 2016
On Sun, Jan 03, 2016 at 01:36:13AM +0100, Andreas Cadhalpun wrote:
> get_bits is documented to only support reading 1-25 bits.
> get_bitsz was added for this purpose.
>
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
> libavcodec/vorbisdec.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
> index f773afa..9ba0bce 100644
> --- a/libavcodec/vorbisdec.c
> +++ b/libavcodec/vorbisdec.c
> @@ -169,7 +169,7 @@ static const char idx_err_str[] = "Index value %d out of range (0 - %d) for %s a
> }
> #define GET_VALIDATED_INDEX(idx, bits, limit) \
> {\
> - idx = get_bits(gb, bits);\
> + idx = get_bitsz(gb, bits);\
> VALIDATE_INDEX(idx, limit)\
> }
this looks wrong
bits is 8 or ilog() where ilog(0) is not allowed one way or another
i think
for example for the audio channels
"the numbers read in the above two steps are channel numbers representing the channel to treat as magnitude and the channel to treat as angle, respectively. If for any coupling step the angle channel number equals the magnitude channel number " ... "the stream is undecodable."
when reading 0 bits both would be 0
>
> @@ -585,7 +585,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
>
> for (j = 0; j < floor_setup->data.t1.partitions; ++j) {
> for (k = 0; k < floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]]; ++k, ++floor1_values) {
> - floor_setup->data.t1.list[floor1_values].x = get_bits(gb, rangebits);
> + floor_setup->data.t1.list[floor1_values].x = get_bitsz(gb, rangebits);
IIUC
"Vector [floor1_x_list] is limited to a maximum length of 65 elements; a setup indicating more than 65 total elements (including elements 0 and 1 set prior to the read loop) renders the stream undecodable. All vector [floor1_x_list] element values must be unique within the vector; a non-unique value renders the stream undecodable. "
suggests that values cannot be 0 as the first is hardcoded to 0
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160103/c970c2f7/attachment.sig>
More information about the ffmpeg-devel
mailing list