mirror of https://git.ffmpeg.org/ffmpeg.git
binkaudio: remove unneeded GET_BITS_SAFE macro
Normal get_bits() already has overread protection.
This commit is contained in:
parent
7bfd1766d1
commit
ee90119e9e
|
@ -158,12 +158,6 @@ static const uint8_t rle_length_tab[16] = {
|
||||||
2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
|
2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GET_BITS_SAFE(out, nbits) do { \
|
|
||||||
if (get_bits_left(gb) < nbits) \
|
|
||||||
return AVERROR_INVALIDDATA; \
|
|
||||||
out = get_bits(gb, nbits); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode Bink Audio block
|
* Decode Bink Audio block
|
||||||
* @param[out] out Output buffer (must contain s->block_size elements)
|
* @param[out] out Output buffer (must contain s->block_size elements)
|
||||||
|
@ -210,10 +204,9 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct)
|
||||||
if (s->version_b) {
|
if (s->version_b) {
|
||||||
j = i + 16;
|
j = i + 16;
|
||||||
} else {
|
} else {
|
||||||
int v;
|
int v = get_bits1(gb);
|
||||||
GET_BITS_SAFE(v, 1);
|
|
||||||
if (v) {
|
if (v) {
|
||||||
GET_BITS_SAFE(v, 4);
|
v = get_bits(gb, 4);
|
||||||
j = i + rle_length_tab[v] * 8;
|
j = i + rle_length_tab[v] * 8;
|
||||||
} else {
|
} else {
|
||||||
j = i + 8;
|
j = i + 8;
|
||||||
|
@ -222,7 +215,7 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct)
|
||||||
|
|
||||||
j = FFMIN(j, s->frame_len);
|
j = FFMIN(j, s->frame_len);
|
||||||
|
|
||||||
GET_BITS_SAFE(width, 4);
|
width = get_bits(gb, 4);
|
||||||
if (width == 0) {
|
if (width == 0) {
|
||||||
memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
|
memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
|
||||||
i = j;
|
i = j;
|
||||||
|
@ -232,10 +225,10 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct)
|
||||||
while (i < j) {
|
while (i < j) {
|
||||||
if (s->bands[k] == i)
|
if (s->bands[k] == i)
|
||||||
q = quant[k++];
|
q = quant[k++];
|
||||||
GET_BITS_SAFE(coeff, width);
|
coeff = get_bits(gb, width);
|
||||||
if (coeff) {
|
if (coeff) {
|
||||||
int v;
|
int v;
|
||||||
GET_BITS_SAFE(v, 1);
|
v = get_bits1(gb);
|
||||||
if (v)
|
if (v)
|
||||||
coeffs[i] = -q * coeff;
|
coeffs[i] = -q * coeff;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue