Skip to content

Commit

Permalink
Fix range end checks, range end can be the same with data length beca…
Browse files Browse the repository at this point in the history
…use the end bracket is open
  • Loading branch information
chcharcharlie committed Aug 22, 2023
1 parent aaea854 commit b814608
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 b814608

Please sign in to comment.