Skip to content

Commit

Permalink
Check stream length
Browse files Browse the repository at this point in the history
  • Loading branch information
J-F-Liu committed Nov 30, 2021
1 parent 53090ad commit 25ccd7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl Document {
{
collect_resources(page_tree, resource_ids, doc);
}
};
}

let mut resource_dict = None;
let mut resource_ids = Vec::new();
Expand Down Expand Up @@ -291,7 +291,7 @@ impl Document {
}
}
}
};
}

let mut fonts = BTreeMap::new();
let (resource_dict, resource_ids) = self.get_page_resources(page_id);
Expand Down
1 change: 1 addition & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ fn stream<'a>(reader: &'a Reader) -> Parser<'a, u8, Stream> {
}
value.as_i64()
}) {
assert!(length >= 0, "invalid negative stream length");
let stream = take(length as usize) - eol().opt() - seq(b"endstream").expect("endstream");
stream.map(move |data| Stream::new(dict.clone(), data.to_vec()))
} else {
Expand Down

0 comments on commit 25ccd7f

Please sign in to comment.