mirror of
https://github.com/mpv-player/mpv
synced 2025-04-07 18:14:33 +00:00
Fix stupid and almost pointless check-after-read code in asfheader.c.
Fixes bug #1133. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27243 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8760b0cb71
commit
80256aee5e
@ -591,24 +591,24 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
|
|||||||
// find content header
|
// find content header
|
||||||
pos = find_asf_guid(hdr, asf_stream_group_guid, 0, hdr_len);
|
pos = find_asf_guid(hdr, asf_stream_group_guid, 0, hdr_len);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
|
int max_streams = (hdr_len - pos - 2) / 6;
|
||||||
uint16_t stream_id, i;
|
uint16_t stream_id, i;
|
||||||
uint32_t max_bitrate;
|
uint32_t max_bitrate;
|
||||||
char *ptr = &hdr[pos];
|
char *ptr = &hdr[pos];
|
||||||
mp_msg(MSGT_HEADER,MSGL_V,"============ ASF Stream group == START ===\n");
|
mp_msg(MSGT_HEADER,MSGL_V,"============ ASF Stream group == START ===\n");
|
||||||
|
if(max_streams <= 0) goto len_err_out;
|
||||||
stream_count = AV_RL16(ptr);
|
stream_count = AV_RL16(ptr);
|
||||||
ptr += sizeof(uint16_t);
|
ptr += sizeof(uint16_t);
|
||||||
if (ptr > &hdr[hdr_len]) goto len_err_out;
|
if(stream_count > max_streams) stream_count = max_streams;
|
||||||
if(stream_count > 0)
|
if(stream_count > 0)
|
||||||
streams = malloc(2*stream_count*sizeof(uint32_t));
|
streams = malloc(2*stream_count*sizeof(uint32_t));
|
||||||
mp_msg(MSGT_HEADER,MSGL_V," stream count=[0x%x][%u]\n", stream_count, stream_count );
|
mp_msg(MSGT_HEADER,MSGL_V," stream count=[0x%x][%u]\n", stream_count, stream_count );
|
||||||
for( i=0 ; i<stream_count ; i++ ) {
|
for( i=0 ; i<stream_count ; i++ ) {
|
||||||
stream_id = AV_RL16(ptr);
|
stream_id = AV_RL16(ptr);
|
||||||
ptr += sizeof(uint16_t);
|
ptr += sizeof(uint16_t);
|
||||||
if (ptr > &hdr[hdr_len]) goto len_err_out;
|
|
||||||
memcpy(&max_bitrate, ptr, sizeof(uint32_t));// workaround unaligment bug on sparc
|
memcpy(&max_bitrate, ptr, sizeof(uint32_t));// workaround unaligment bug on sparc
|
||||||
max_bitrate = le2me_32(max_bitrate);
|
max_bitrate = le2me_32(max_bitrate);
|
||||||
ptr += sizeof(uint32_t);
|
ptr += sizeof(uint32_t);
|
||||||
if (ptr > &hdr[hdr_len]) goto len_err_out;
|
|
||||||
mp_msg(MSGT_HEADER,MSGL_V," stream id=[0x%x][%u]\n", stream_id, stream_id );
|
mp_msg(MSGT_HEADER,MSGL_V," stream id=[0x%x][%u]\n", stream_id, stream_id );
|
||||||
mp_msg(MSGT_HEADER,MSGL_V," max bitrate=[0x%x][%u]\n", max_bitrate, max_bitrate );
|
mp_msg(MSGT_HEADER,MSGL_V," max bitrate=[0x%x][%u]\n", max_bitrate, max_bitrate );
|
||||||
streams[2*i] = stream_id;
|
streams[2*i] = stream_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user