mirror of https://git.videolan.org/git/ffmpeg.git
avformat/rtpdec: return value check for init_get_bits()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
parent
d9f05bea5c
commit
c825de87c9
|
@ -119,7 +119,9 @@ static int h261_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_h261_ctx
|
||||||
} else {
|
} else {
|
||||||
/* ebit/sbit values inconsistent, assuming packet loss */
|
/* ebit/sbit values inconsistent, assuming packet loss */
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
init_get_bits(&gb, buf, len*8 - ebit);
|
res = init_get_bits(&gb, buf, len*8 - ebit);
|
||||||
|
if (res < 0)
|
||||||
|
return res;
|
||||||
skip_bits(&gb, sbit);
|
skip_bits(&gb, sbit);
|
||||||
if (rtp_h261_ctx->endbyte_bits) {
|
if (rtp_h261_ctx->endbyte_bits) {
|
||||||
rtp_h261_ctx->endbyte |= get_bits(&gb, 8 - rtp_h261_ctx->endbyte_bits);
|
rtp_h261_ctx->endbyte |= get_bits(&gb, 8 - rtp_h261_ctx->endbyte_bits);
|
||||||
|
|
|
@ -142,7 +142,9 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
} else {
|
} else {
|
||||||
/* Start/end skip bits not matching - missed packets? */
|
/* Start/end skip bits not matching - missed packets? */
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
init_get_bits(&gb, buf, len*8 - ebit);
|
ret = init_get_bits(&gb, buf, len*8 - ebit);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
skip_bits(&gb, sbit);
|
skip_bits(&gb, sbit);
|
||||||
if (data->endbyte_bits) {
|
if (data->endbyte_bits) {
|
||||||
data->endbyte |= get_bits(&gb, 8 - data->endbyte_bits);
|
data->endbyte |= get_bits(&gb, 8 - data->endbyte_bits);
|
||||||
|
|
|
@ -101,7 +101,9 @@ static int parse_fmtp_config(AVStream *st, const char *value)
|
||||||
if (!config)
|
if (!config)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
ff_hex_to_data(config, value);
|
ff_hex_to_data(config, value);
|
||||||
init_get_bits(&gb, config, len*8);
|
ret = init_get_bits(&gb, config, len*8);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
audio_mux_version = get_bits(&gb, 1);
|
audio_mux_version = get_bits(&gb, 1);
|
||||||
same_time_framing = get_bits(&gb, 1);
|
same_time_framing = get_bits(&gb, 1);
|
||||||
skip_bits(&gb, 6); /* num_sub_frames */
|
skip_bits(&gb, 6); /* num_sub_frames */
|
||||||
|
|
|
@ -124,6 +124,7 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
int au_headers_length, au_header_size, i;
|
int au_headers_length, au_header_size, i;
|
||||||
GetBitContext getbitcontext;
|
GetBitContext getbitcontext;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (len < 2)
|
if (len < 2)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
@ -144,7 +145,9 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
|
||||||
if (len < data->au_headers_length_bytes)
|
if (len < data->au_headers_length_bytes)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8);
|
ret = init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/* XXX: Wrong if optional additional sections are present (cts, dts etc...) */
|
/* XXX: Wrong if optional additional sections are present (cts, dts etc...) */
|
||||||
au_header_size = data->sizelength + data->indexlength;
|
au_header_size = data->sizelength + data->indexlength;
|
||||||
|
|
|
@ -82,7 +82,9 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||||
* The RTP payload is described in:
|
* The RTP payload is described in:
|
||||||
* http://developer.apple.com/quicktime/icefloe/dispatch026.html
|
* http://developer.apple.com/quicktime/icefloe/dispatch026.html
|
||||||
*/
|
*/
|
||||||
init_get_bits(&gb, buf, len << 3);
|
ret = init_get_bits(&gb, buf, len << 3);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
ffio_init_context(&pb0, (uint8_t*)buf, len, 0, NULL, NULL, NULL, NULL);
|
ffio_init_context(&pb0, (uint8_t*)buf, len, 0, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (len < 4)
|
if (len < 4)
|
||||||
|
|
Loading…
Reference in New Issue