mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
padding: fix "Size computation for allocation may overflow"
This commit is contained in:
parent
93c965f3c1
commit
3cc92436ee
@ -30,6 +30,11 @@ func (pad iso9797M3Padding) Pad(src []byte) []byte {
|
||||
|
||||
var head, tail []byte
|
||||
total := srcLen + overhead + pad.BlockSize()
|
||||
|
||||
if total <= 0 {
|
||||
panic("padding: total length overflow")
|
||||
}
|
||||
|
||||
if cap(src) >= total {
|
||||
head = src[:total]
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user