|
@@ -6,6 +6,7 @@ import (
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"errors"
|
|
"errors"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "math"
|
|
|
"strings"
|
|
"strings"
|
|
|
"sync"
|
|
"sync"
|
|
|
"time"
|
|
"time"
|
|
@@ -47,6 +48,9 @@ func (c ClientWithAttachments) MarshalJSON() ([]byte, error) {
|
|
|
if len(rec) < 2 || rec[len(rec)-1] != '}' || len(extra) <= 2 {
|
|
if len(rec) < 2 || rec[len(rec)-1] != '}' || len(extra) <= 2 {
|
|
|
return rec, nil
|
|
return rec, nil
|
|
|
}
|
|
}
|
|
|
|
|
+ if len(extra) > math.MaxInt-len(rec) {
|
|
|
|
|
+ return rec, nil
|
|
|
|
|
+ }
|
|
|
out := make([]byte, 0, len(rec)+len(extra))
|
|
out := make([]byte, 0, len(rec)+len(extra))
|
|
|
out = append(out, rec[:len(rec)-1]...)
|
|
out = append(out, rec[:len(rec)-1]...)
|
|
|
if len(rec) > 2 {
|
|
if len(rec) > 2 {
|