Skip to content

Commit

Permalink
Merge pull request #207 from TileDB-Inc/add-write-bytes-length-check
Browse files Browse the repository at this point in the history
Protect against empty byte writes
  • Loading branch information
snagles authored Jan 5, 2022
2 parents 2c006fc + e818ab3 commit f1fde2e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,9 @@ func (v *VFSfh) Read(p []byte) (int, error) {
// appends data at the end of the file. If the file does not exist,
// it will be created
func (v *VFSfh) Write(bytes []byte) (int, error) {
if len(bytes) == 0 {
return 0, nil
}
cbuffer := unsafe.Pointer(&bytes[0])
ret := C.tiledb_vfs_write(v.context.tiledbContext, v.tiledbVFSfh, cbuffer, C.uint64_t(len(bytes)))

Expand Down

0 comments on commit f1fde2e

Please sign in to comment.