Skip to content

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Feb 10, 2024

  • $checklength is the maximum offset in buffer to check which byte(s) in the 2 buffers are not equal
  • The subsequent loop is from 0 to $checklength, so avoid potentially accessing $bytes1[$chunk_size]
  • If $read_in1 and $read_in2 are equal to $chunk_size, the value of $checklength is not decremented
  • Calculate minimum of $read_in1 and $read_in2 (these will never exceed $chunk_size), then decrement by 1

* $checklength is the maximum offset in buffer to check which byte(s) in the 2 buffers are not equal
* The subsequent loop is from 0 to $checklength, so avoid potentially accessing $bytes1[$chunk_size]
* If $read_in1 and $read_in2 are equal to $chunk_size, the value of $checklength is not decremented
* Calculate minimum of $read_in1 and $read_in2 (these will never exceed $chunk_size), then decrement by 1
@github-actions github-actions bot added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: cmp The cop program labels Feb 10, 2024
@briandfoy briandfoy merged commit cba333a into briandfoy:master Feb 11, 2024
@briandfoy briandfoy self-assigned this Feb 11, 2024
@briandfoy briandfoy added Status: accepted The fix is accepted and removed Priority: low get to this whenever labels Feb 11, 2024
@briandfoy
Copy link
Owner

changes: fix off-by-one error

@briandfoy briandfoy added Status: released there is a new release with this fix and removed Status: accepted The fix is accepted labels Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: cmp The cop program Status: released there is a new release with this fix Type: enhancement improve a feature that already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants