mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2024-11-25 10:10:58 +00:00
When a manifest is incomplete or damaged, the contains_master_tag
may go into infinite loop if is_master_playlist_tag_line
detection hasn't had a chance to succeed.
Clippy recommendation is implemented to use `.is_none()` instead of comparing to literal `Option::None`. Test added
This commit is contained in:
parent
14d24b94c8
commit
b0a9fe2625
1 changed files with 9 additions and 1 deletions
|
@ -143,7 +143,7 @@ fn contains_master_tag(input: &[u8]) -> Option<(bool, String)> {
|
|||
let mut is_master_opt = None;
|
||||
let mut current_input: &[u8] = input;
|
||||
|
||||
while is_master_opt == None {
|
||||
while is_master_opt.is_none() && !current_input.is_empty() {
|
||||
match is_master_playlist_tag_line(current_input) {
|
||||
IResult::Ok((rest, result)) => {
|
||||
current_input = rest;
|
||||
|
@ -986,4 +986,12 @@ mod tests {
|
|||
Result::Ok(("rest".as_bytes(), (2.002f32, Some("title".to_string()))))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incomplete_manifest() {
|
||||
assert_eq!(
|
||||
is_master_playlist("#EXTM3U\n#EXT-X-VERSION:5\n#EXT-X-TARGETDU".as_bytes()),
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue