aboutsummaryrefslogtreecommitdiff
path: root/rabbit.go
diff options
context:
space:
mode:
authorsina <sina@snix.ir>2022-07-30 19:01:05 +0430
committersina <sina@snix.ir>2022-07-30 19:01:05 +0430
commite697fd436cabccb32114ebb74d1de9b9516dead3 (patch)
treee25f2719602779da65d8874b178fae7396c8f6e3 /rabbit.go
parentf3dc60d49043cdf866c69a5df8bfe665a81e874b (diff)
panics and overlap
Diffstat (limited to 'rabbit.go')
-rw-r--r--rabbit.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/rabbit.go b/rabbit.go
index 3b2ed12..3d77daa 100644
--- a/rabbit.go
+++ b/rabbit.go
@@ -136,6 +136,15 @@ func (r *rabbitCipher) extract() {
// XORKeyStream read from src and perform xor on every elemnt of src and
// write result on dst
func (r *rabbitCipher) XORKeyStream(dst, src []byte) {
+
+ if len(dst) < len(src) {
+ panic("rabbitio: output smaller than input")
+ }
+
+ if InexactOverlap(dst, src) {
+ panic("rabbitio: invalid buffer memory overlap")
+ }
+
for i := range src {
if len(r.ks) == 0x00 {
r.extract()

Snix LLC Git Repository Holder Copyright(C) 2022 All Rights Reserved Email To Snix.IR