mirror of
https://github.com/HACKERALERT/Picocrypt.git
synced 2024-12-30 19:32:33 +00:00
Fix typo and better size checking
This commit is contained in:
parent
53c7b5caf4
commit
81292c6345
1 changed files with 7 additions and 6 deletions
|
@ -2,7 +2,7 @@ package main
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Picocrypt v1.24
|
Picocrypt v1.25
|
||||||
Copyright (c) Evan Su (https://evansu.cc)
|
Copyright (c) Evan Su (https://evansu.cc)
|
||||||
Released under a GNU GPL v3 License
|
Released under a GNU GPL v3 License
|
||||||
https://github.com/HACKERALERT/Picocrypt
|
https://github.com/HACKERALERT/Picocrypt
|
||||||
|
@ -48,7 +48,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Generic variables
|
// Generic variables
|
||||||
var version = "v1.24"
|
var version = "v1.25"
|
||||||
var window *giu.MasterWindow
|
var window *giu.MasterWindow
|
||||||
var dpi float32
|
var dpi float32
|
||||||
var mode string
|
var mode string
|
||||||
|
@ -926,12 +926,12 @@ func work() {
|
||||||
stat, _ := os.Stat(inputFile)
|
stat, _ := os.Stat(inputFile)
|
||||||
total := stat.Size()
|
total := stat.Size()
|
||||||
if mode == "decrypt" {
|
if mode == "decrypt" {
|
||||||
total -= 786
|
total -= 789
|
||||||
}
|
}
|
||||||
|
|
||||||
// XChaCha20's max message size is 256 GiB
|
// XChaCha20's max input is 256 GiB, panic at one block less
|
||||||
if total > 256*1073741824 {
|
if total >= int64((math.Pow(2, 32)-1)*64) {
|
||||||
mainStatus = "The input file is too big to encrypt."
|
mainStatus = "The input data is too big to encrypt."
|
||||||
mainStatusColor = color.RGBA{0xff, 0x00, 0x00, 0xff}
|
mainStatusColor = color.RGBA{0xff, 0x00, 0x00, 0xff}
|
||||||
if len(allFiles) > 1 || len(onlyFolders) > 0 {
|
if len(allFiles) > 1 || len(onlyFolders) > 0 {
|
||||||
os.Remove(inputFile)
|
os.Remove(inputFile)
|
||||||
|
@ -1041,6 +1041,7 @@ func work() {
|
||||||
tmp, errs[1] = rsDecode(rs5, tmp)
|
tmp, errs[1] = rsDecode(rs5, tmp)
|
||||||
commentsLength, _ := strconv.Atoi(string(tmp))
|
commentsLength, _ := strconv.Atoi(string(tmp))
|
||||||
fin.Read(make([]byte, commentsLength*3))
|
fin.Read(make([]byte, commentsLength*3))
|
||||||
|
total -= int64(commentsLength) * 3
|
||||||
|
|
||||||
flags := make([]byte, 15)
|
flags := make([]byte, 15)
|
||||||
fin.Read(flags)
|
fin.Read(flags)
|
||||||
|
|
Loading…
Reference in a new issue