Commit 8dca0877 authored by Nidhi Makhijani's avatar Nidhi Makhijani Committed by Diego Biurrun

mpegts: Return proper error code on invalid input data

Signed-off-by: 's avatarDiego Biurrun <diego@biurrun.de>
parent 59cc0812
...@@ -165,7 +165,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id, ...@@ -165,7 +165,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
tot_len = 3 + 5 + len + 4; tot_len = 3 + 5 + len + 4;
/* check if not too big */ /* check if not too big */
if (tot_len > 1024) if (tot_len > 1024)
return -1; return AVERROR_INVALIDDATA;
q = section; q = section;
*q++ = tid; *q++ = tid;
...@@ -1006,7 +1006,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) ...@@ -1006,7 +1006,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
if (ts_st->first_pts_check && pts == AV_NOPTS_VALUE) { if (ts_st->first_pts_check && pts == AV_NOPTS_VALUE) {
av_log(s, AV_LOG_ERROR, "first pts value must set\n"); av_log(s, AV_LOG_ERROR, "first pts value must set\n");
return AVERROR(EINVAL); return AVERROR_INVALIDDATA;
} }
ts_st->first_pts_check = 0; ts_st->first_pts_check = 0;
...@@ -1017,7 +1017,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) ...@@ -1017,7 +1017,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) { if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, " av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, "
"no startcode found, use -bsf h264_mp4toannexb\n"); "no startcode found, use -bsf h264_mp4toannexb\n");
return AVERROR(EINVAL); return AVERROR_INVALIDDATA;
} }
do { do {
...@@ -1040,7 +1040,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) ...@@ -1040,7 +1040,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
} else if (st->codec->codec_id == AV_CODEC_ID_AAC) { } else if (st->codec->codec_id == AV_CODEC_ID_AAC) {
if (pkt->size < 2) { if (pkt->size < 2) {
av_log(s, AV_LOG_ERROR, "AAC packet too short\n"); av_log(s, AV_LOG_ERROR, "AAC packet too short\n");
return AVERROR(EINVAL); return AVERROR_INVALIDDATA;
} }
if ((AV_RB16(pkt->data) & 0xfff0) != 0xfff0) { if ((AV_RB16(pkt->data) & 0xfff0) != 0xfff0) {
int ret; int ret;
...@@ -1049,7 +1049,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) ...@@ -1049,7 +1049,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
if (!ts_st->amux) { if (!ts_st->amux) {
av_log(s, AV_LOG_ERROR, "AAC bitstream not in ADTS format " av_log(s, AV_LOG_ERROR, "AAC bitstream not in ADTS format "
"and extradata missing\n"); "and extradata missing\n");
return AVERROR(EINVAL); return AVERROR_INVALIDDATA;
} }
av_init_packet(&pkt2); av_init_packet(&pkt2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment