mirror of https://git.ffmpeg.org/ffmpeg.git
Check 4xm headers for validity. This should avoid 1/0.
Originally committed as revision 26392 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
30876e3917
commit
8bb7d97be0
|
@ -185,6 +185,13 @@ static int fourxm_read_header(AVFormatContext *s,
|
||||||
fourxm->tracks[current_track].sample_rate = AV_RL32(&header[i + 40]);
|
fourxm->tracks[current_track].sample_rate = AV_RL32(&header[i + 40]);
|
||||||
fourxm->tracks[current_track].bits = AV_RL32(&header[i + 44]);
|
fourxm->tracks[current_track].bits = AV_RL32(&header[i + 44]);
|
||||||
fourxm->tracks[current_track].audio_pts = 0;
|
fourxm->tracks[current_track].audio_pts = 0;
|
||||||
|
if( fourxm->tracks[current_track].channels <= 0
|
||||||
|
|| fourxm->tracks[current_track].sample_rate <= 0
|
||||||
|
|| fourxm->tracks[current_track].bits < 0){
|
||||||
|
av_log(s, AV_LOG_ERROR, "audio header invalid\n");
|
||||||
|
ret= -1;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
i += 8 + size;
|
i += 8 + size;
|
||||||
|
|
||||||
/* allocate a new AVStream */
|
/* allocate a new AVStream */
|
||||||
|
@ -291,7 +298,7 @@ static int fourxm_read_packet(AVFormatContext *s,
|
||||||
out_size= get_le32(pb);
|
out_size= get_le32(pb);
|
||||||
size-=8;
|
size-=8;
|
||||||
|
|
||||||
if (track_number < fourxm->track_count) {
|
if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
|
||||||
ret= av_get_packet(s->pb, pkt, size);
|
ret= av_get_packet(s->pb, pkt, size);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
|
|
Loading…
Reference in New Issue