Skip to content

Commit

Permalink
Merge pull request #306 from chcharcharlie/rangeend
Browse files Browse the repository at this point in the history
Fix range end checks, range end can be the same with data length because the end bracket is open
  • Loading branch information
themighty1 authored Aug 23, 2023
2 parents aaea854 + b814608 commit ec364ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tlsn/tlsn-core/src/substrings/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ impl SubstringsProof {
for comm in self.inclusion_proof.commitments().iter() {
if comm.direction() == &Direction::Sent {
for r in comm.ranges() {
if r.end >= header.sent_len() {
if r.end > header.sent_len() {
return Err(Error::ValidationError);
}
}
} else {
// comm.direction() == &Direction::Received
for r in comm.ranges() {
if r.end >= header.recv_len() {
if r.end > header.recv_len() {
return Err(Error::ValidationError);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tlsn/tlsn-core/src/transcript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Transcript {

let mut dst: Vec<u8> = Vec::new();
for r in ranges {
if r.end as usize >= self.data.len() {
if r.end as usize > self.data.len() {
// range bounds must be within `src` length
return Err(Error::InternalError);
} else {
Expand Down

0 comments on commit ec364ce

Please sign in to comment.