comparison libmpdemux/demux_real.c @ 18106:3a34a728fa1b

always cast stream IDs to unsigned before comparing to MAX_STREAMS. just defining them as unsigned might be a better fix though...
author reimar
date Sat, 15 Apr 2006 21:09:29 +0000
parents f70772d02eaa
children f72bc5754209
comparison
equal deleted inserted replaced
18105:954eac69b532 18106:3a34a728fa1b
160 int i, entries; 160 int i, entries;
161 161
162 if ( mp_msg_test(MSGT_DEMUX,MSGL_V) ) 162 if ( mp_msg_test(MSGT_DEMUX,MSGL_V) )
163 return; 163 return;
164 164
165 if (stream_id >= MAX_STREAMS) 165 if ((unsigned)stream_id >= MAX_STREAMS)
166 return; 166 return;
167 167
168 index = priv->index_table[stream_id]; 168 index = priv->index_table[stream_id];
169 entries = priv->index_table_size[stream_id]; 169 entries = priv->index_table_size[stream_id];
170 170
1038 } 1038 }
1039 1039
1040 return 1; 1040 return 1;
1041 } 1041 }
1042 1042
1043 if(stream_id<MAX_STREAMS){ 1043 if((unsigned)stream_id<MAX_STREAMS){
1044 1044
1045 if(demuxer->audio->id==-1 && demuxer->a_streams[stream_id]){ 1045 if(demuxer->audio->id==-1 && demuxer->a_streams[stream_id]){
1046 sh_audio_t *sh = demuxer->a_streams[stream_id]; 1046 sh_audio_t *sh = demuxer->a_streams[stream_id];
1047 demuxer->audio->id=stream_id; 1047 demuxer->audio->id=stream_id;
1048 sh->ds=demuxer->audio; 1048 sh->ds=demuxer->audio;
1633 int stream_list[MAX_STREAMS]; 1633 int stream_list[MAX_STREAMS];
1634 1634
1635 priv->is_multirate = 1; 1635 priv->is_multirate = 1;
1636 stream_skip(demuxer->stream, 4); // Length of codec data (repeated) 1636 stream_skip(demuxer->stream, 4); // Length of codec data (repeated)
1637 stream_cnt = stream_read_dword(demuxer->stream); // Get number of audio or video streams 1637 stream_cnt = stream_read_dword(demuxer->stream); // Get number of audio or video streams
1638 if (stream_cnt >= MAX_STREAMS) { 1638 if ((unsigned)stream_cnt >= MAX_STREAMS) {
1639 mp_msg(MSGT_DEMUX,MSGL_ERR,"Too many streams in %s. Big troubles ahead.\n", mimet); 1639 mp_msg(MSGT_DEMUX,MSGL_ERR,"Too many streams in %s. Big troubles ahead.\n", mimet);
1640 goto skip_this_chunk; 1640 goto skip_this_chunk;
1641 } 1641 }
1642 for (i = 0; i < stream_cnt; i++) 1642 for (i = 0; i < stream_cnt; i++)
1643 stream_list[i] = stream_read_word(demuxer->stream); 1643 stream_list[i] = stream_read_word(demuxer->stream);
1644 for (i = 0; i < stream_cnt; i++) 1644 for (i = 0; i < stream_cnt; i++)
1645 if (stream_list[i] >= MAX_STREAMS) { 1645 if ((unsigned)stream_list[i] >= MAX_STREAMS) {
1646 mp_msg(MSGT_DEMUX,MSGL_ERR,"Stream id out of range: %d. Ignored.\n", stream_list[i]); 1646 mp_msg(MSGT_DEMUX,MSGL_ERR,"Stream id out of range: %d. Ignored.\n", stream_list[i]);
1647 stream_skip(demuxer->stream, 4); // Skip DATA offset for broken stream 1647 stream_skip(demuxer->stream, 4); // Skip DATA offset for broken stream
1648 } else { 1648 } else {
1649 priv->str_data_offset[stream_list[i]] = stream_read_dword(demuxer->stream); 1649 priv->str_data_offset[stream_list[i]] = stream_read_dword(demuxer->stream);
1650 mp_msg(MSGT_DEMUX,MSGL_V,"Stream %d with DATA offset 0x%08x\n", stream_list[i], priv->str_data_offset[stream_list[i]]); 1650 mp_msg(MSGT_DEMUX,MSGL_V,"Stream %d with DATA offset 0x%08x\n", stream_list[i], priv->str_data_offset[stream_list[i]]);