Changeset 423
- Timestamp:
- 02/11/09 23:41:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/libmpcdec/mpc_demux.c
r419 r423 115 115 116 116 /** 117 * checks if a block key is valid 118 * @param key the two caracters key to check 119 * @return MPC_STATUS_INVALIDSV if the key is invalid, MPC_STATUS_OK else 120 */ 121 static inline mpc_status mpc_check_key(char * key) 122 { 123 if (key[0] < 65 || key[0] > 90 || key[1] < 65 || key[1] > 90) 124 return MPC_STATUS_INVALIDSV; 125 return MPC_STATUS_OK; 126 } 127 128 /** 117 129 * seek to a bit position in the stream 118 130 * @param d demuxer context … … 304 316 int tag_size = 0, chap_size = 0, size, i = 0; 305 317 318 d->chap_nb = 0; 319 306 320 if (d->si.stream_version < 8) 307 321 return; … … 312 326 size = mpc_bits_get_block(&d->bits_reader, &b); 313 327 while (memcmp(b.key, "SE", 2) != 0) { 328 if (mpc_check_key(b.key) != MPC_STATUS_OK) 329 return; 314 330 if (memcmp(b.key, "CT", 2) == 0) { 315 331 if (d->chap_pos == 0) d->chap_pos = cur_pos; … … 324 340 } 325 341 326 d->chap_nb = 0;327 342 mpc_demux_seek(d, d->chap_pos, 20); 328 343 size = mpc_bits_get_block(&d->bits_reader, &b); … … 425 440 size = mpc_bits_get_block(&d->bits_reader, &b); 426 441 while( memcmp(b.key, "AP", 2) != 0 ){ // scan all blocks until audio 427 if ( b.key[0] < 65 || b.key[0] > 90 || b.key[1] < 65 || b.key[1] > 90)442 if (mpc_check_key(b.key) != MPC_STATUS_OK) 428 443 return MPC_STATUS_INVALIDSV; 429 444 if (b.size > (mpc_uint64_t) DEMUX_BUFFER_SIZE - 11) … … 505 520 mpc_bits_get_block(&d->bits_reader, &b); 506 521 while( memcmp(b.key, "AP", 2) != 0 ) { // scan all blocks until audio 507 if ( b.key[0] < 65 || b.key[0] > 90 || b.key[1] < 65 || b.key[1] > 90)522 if (mpc_check_key(b.key) != MPC_STATUS_OK) 508 523 goto error; 509 524 if (memcmp(b.key, "SE", 2) == 0) { // end block
Note: See TracChangeset
for help on using the changeset viewer.