c2pa-rs

A fork of https://github.com/contentauth/c2pa-rs/
git clone git://archive.git.mtrnord.blog/mtrnords-photography-manager/c2pa-rs.git
Log | Files | Refs | README

commit 3f9e7cc0df6ccc5aa9ca7d5294c799004c5dad7f
parent 2d84280ae6729b4474a2982fdf543bf9e407f627
Author: mauricefisher64 <92736594+mauricefisher64@users.noreply.github.com>
Date:   Mon, 12 Feb 2024 08:34:13 -0500

Crate udate to fix jpeg parsing error (#402)

* Fix for jpg images with 0 length segments when using boxhash

* Fix change in how position is reported from version 5 of jfifdump

---------

Co-authored-by: Dylan ross <dyro@me.com>
Diffstat:
Msdk/Cargo.toml | 2+-
Msdk/src/asset_handlers/jpeg_io.rs | 28++++++++++++++--------------
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml @@ -79,7 +79,7 @@ fast-xml = "0.23.1" hex = "0.4.3" id3 = "1.7.0" img-parts = "0.3.0" -jfifdump = "0.4.0" +jfifdump = "0.5.1" log = "0.4.8" lopdf = { version = "0.31.0", optional = true } lazy_static = "1.4.0" diff --git a/sdk/src/asset_handlers/jpeg_io.rs b/sdk/src/asset_handlers/jpeg_io.rs @@ -713,7 +713,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -725,7 +725,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -763,7 +763,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: raw_bytes.len() + 4, }; @@ -779,7 +779,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -801,7 +801,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -813,7 +813,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -825,7 +825,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -837,7 +837,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -849,7 +849,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -865,7 +865,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -877,7 +877,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -889,7 +889,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -902,7 +902,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, }; @@ -918,7 +918,7 @@ fn make_box_maps(input_stream: &mut dyn CAIRead) -> Result<Vec<BoxMap>> { alg: None, hash: ByteBuf::from(Vec::new()), pad: ByteBuf::from(Vec::new()), - range_start: seg.position - 2, + range_start: seg.position, range_len: 0, };