reverse: print value in file offset panic

This commit is contained in:
Jakob Unterwurzacher 2016-09-02 21:01:03 +02:00
parent a34b447ad1
commit e42ab3908d
1 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package contentenc package contentenc
import ( import (
"log"
"github.com/rfjakob/gocryptfs/internal/tlog" "github.com/rfjakob/gocryptfs/internal/tlog"
) )
@ -14,7 +16,7 @@ func (be *ContentEnc) PlainOffToBlockNo(plainOffset uint64) uint64 {
// get the block number at cipher-text offset // get the block number at cipher-text offset
func (be *ContentEnc) CipherOffToBlockNo(cipherOffset uint64) uint64 { func (be *ContentEnc) CipherOffToBlockNo(cipherOffset uint64) uint64 {
if cipherOffset < HEADER_LEN { if cipherOffset < HEADER_LEN {
panic("BUG: offset is inside the file header") log.Panicf("BUG: offset %d is inside the file header", cipherOffset)
} }
return (cipherOffset - HEADER_LEN) / be.cipherBS return (cipherOffset - HEADER_LEN) / be.cipherBS
} }