Skip to content

Commit

Permalink
Merge pull request #1 from kolesa-team/invalid-image-pointer-fix
Browse files Browse the repository at this point in the history
`GetBytes` now copies the image retrieved from exiv2 library
  • Loading branch information
antonsergeyev authored Apr 16, 2021
2 parents 497f6a5 + 6bc1fa6 commit 00c1a75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion exiv.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ func (i *Image) GetBytes() []byte {
header.Len = size
header.Data = uintptr(unsafe.Pointer(ptr))

return slice
target := make([]byte, len(slice))
copy(target, slice)

return target
}

// PixelWidth returns the width of the image in pixels
Expand Down

0 comments on commit 00c1a75

Please sign in to comment.