[FFmpeg-devel] [PATCH] vorbisdec: avoid calling get_bits to read 0 bits
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Sat Jan 2 20:01:21 CET 2016
It's documented to only support reading 1-25 bits.
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..1db8bd8 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 = bits ? get_bits(gb, bits) : 0;\
VALIDATE_INDEX(idx, limit)\
}
@@ -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 = rangebits ? get_bits(gb, rangebits) : 0;
ff_dlog(NULL, " %u. floor1 Y coord. %d\n", floor1_values,
floor_setup->data.t1.list[floor1_values].x);
--
2.6.4
More information about the ffmpeg-devel
mailing list