Skip to content

Commit

Permalink
Fixed parsing of the PDFs with incorrect xrefs to indirect objects (#254
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ancwrd1 authored Dec 26, 2023
1 parent 4f90c45 commit 289e6b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nom_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ pub fn indirect_object(
fn _indirect_object(
input: &[u8], offset: usize, expected_id: Option<ObjectId>, reader: &Reader,
) -> crate::Result<(ObjectId, Object)> {
let (i, object_id) = terminated(object_id, pair(tag(b"obj"), space))(input).map_err(|_| Error::Parse { offset })?;
let (i, (_, object_id)) = terminated(tuple((space, object_id)), pair(tag(b"obj"), space))(input).map_err(|_| Error::Parse { offset })?;
if let Some(expected_id) = expected_id {
if object_id != expected_id {
return Err(crate::error::Error::ObjectIdMismatch);
Expand Down

0 comments on commit 289e6b9

Please sign in to comment.