Skip to content

Commit 4299594

Browse files
committed
increase DecodedLen
1 parent b0a5b39 commit 4299594

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

base64.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ func (e *Encoding) EncodeStringToString(src string) string {
5555
}
5656

5757
func (e *Encoding) DecodedLen(n int) int {
58+
sf := 0
59+
if n > 4 {
60+
sf++
61+
}
5862
if !e.pad {
59-
return n * 6 / 8
63+
return n*6/8 + sf
6064
}
61-
return n / 4 * 3
65+
return n/4*3 + sf
6266
}
6367

6468
func (e *Encoding) Decode(dst []byte, src []byte) (int, error) {

0 commit comments

Comments
 (0)