Skip to content

Commit

Permalink
Revert "fix section length"
Browse files Browse the repository at this point in the history
This reverts commit 6c2d66f.
  • Loading branch information
ltn-chriskennedy committed Aug 26, 2024
1 parent 6c2d66f commit e0a6a89
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/stream_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,13 +1283,11 @@ pub fn parse_pat(packet: &[u8]) -> Vec<PatEntry> {
let pointer_field = packet[offset] as usize;
offset += 1 + pointer_field;

let section_length = (((packet[offset + 1] & 0x0F) as usize) << 8) | (packet[offset + 2] as usize);

while offset + 4 <= packet.len() && offset < (pointer_field + 3 + section_length) {
while offset + 4 <= packet.len() {
let program_number = ((packet[offset] as u16) << 8) | (packet[offset + 1] as u16);
let pmt_pid = (((packet[offset + 2] as u16) & 0x1F) << 8) | (packet[offset + 3] as u16);

if program_number != 0 && pmt_pid > 0 && pmt_pid <= 0x1FFF {
if program_number >= 0 && pmt_pid > 0 && pmt_pid <= 0x1FFF && program_number < 5000 {
entries.push(PatEntry {
program_number,
pmt_pid,
Expand Down

0 comments on commit e0a6a89

Please sign in to comment.