Skip to content

Commit

Permalink
fix preallocations of quoted string
Browse files Browse the repository at this point in the history
  • Loading branch information
ninedraft committed Oct 20, 2024
1 parent e5053ee commit 8264272
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/sanitize/sanitize.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func QuoteString(dst []byte, str string) []byte {

dst = append(dst, quote...)

p := slices.Grow(dst[len(dst):], len(str)+2*n)
p := slices.Grow(dst[len(dst):], 2*len(quote)+len(str)+2*n)

for len(str) > 0 {
i := strings.Index(str, quote)
Expand Down
1 change: 1 addition & 0 deletions internal/sanitize/sanitize_fuzz_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sanitize_test

import (
"strings"
"testing"

"github.com/jackc/pgx/v5/internal/sanitize"
Expand Down

0 comments on commit 8264272

Please sign in to comment.