Skip to content

Commit

Permalink
Fix NodeJS and Python bindings on 32-bit system, off-by-one, fixes #707
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed May 22, 2024
1 parent 530e414 commit 4af426d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bindings/js/minify.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func goStringArray(carr **C.char, length C.longlong) []string {
}

strs := make([]string, length)
arr := (*[1 << 31]*C.char)(unsafe.Pointer(carr))[:length:length]
arr := (*[1<<31 - 1]*C.char)(unsafe.Pointer(carr))[:length:length]
for i := 0; i < int(length); i++ {
strs[i] = C.GoString(arr[i])
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/py/minify.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func goStringArray(carr **C.char, length C.longlong) []string {
}

strs := make([]string, length)
arr := (*[1 << 31]*C.char)(unsafe.Pointer(carr))[:length:length]
arr := (*[1<<31 - 1]*C.char)(unsafe.Pointer(carr))[:length:length]
for i := 0; i < int(length); i++ {
strs[i] = C.GoString(arr[i])
}
Expand Down

0 comments on commit 4af426d

Please sign in to comment.