kfogel / OneTime

An open source encryption program that uses the "one-time pad" method.
http://red-bean.com/onetime
32 stars 14 forks source link

Regression from 2.0-beta15 release. #26

Open DomT4 opened 7 years ago

DomT4 commented 7 years ago

Since https://github.com/kfogel/OneTime/commit/76c46de2efdd651846758e419f2ef35743b5968a pulling random data from /dev/random and using it as an directed by onetime --pad-help can result in onetime blowing up, as discussed in https://github.com/Homebrew/homebrew-core/pull/7258 with a random file that'll produce a failure in https://github.com/Homebrew/homebrew-core/pull/7258#issuecomment-263068825.

~> dd if=/dev/random of=pad_data.txt bs=1024 count=1
~> ./onetime -e --pad=pad_data.txt --no-trace --config=. input.txt
Traceback (most recent call last):
  File "./onetime", line 1923, in <module>
    main()
  File "./onetime", line 1841, in main
    result = encoder.finish()
  File "./onetime", line 1493, in finish
    remainder += self.pad_sess.finish()
  File "./onetime", line 1424, in finish
    remainder += self._make_fuzz(self._tail_fuzz_length)
  File "./onetime", line 1105, in _make_fuzz
    ret_data = ret_data + chr(ord(rnd_data[i]) ^ ord(pad_data[i]))
IndexError: string index out of range

Stable and 2.0-beta13, 2.0-beta14 are unaffected, as far as I can discover from testing. Any git checkout prior to https://github.com/kfogel/OneTime/commit/76c46de2efdd651846758e419f2ef35743b5968a works fine using that known-defective /dev/random created file at https://github.com/Homebrew/homebrew-core/pull/7258#issuecomment-263068825.

ilovezfs commented 7 years ago

Ping on this ... any chance of getting it fixed?