Skip to content

Commit 00c1a75

Browse files
Merge pull request #1 from kolesa-team/invalid-image-pointer-fix
`GetBytes` now copies the image retrieved from exiv2 library
2 parents 497f6a5 + 6bc1fa6 commit 00c1a75

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

exiv.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ func (i *Image) GetBytes() []byte {
120120
header.Len = size
121121
header.Data = uintptr(unsafe.Pointer(ptr))
122122

123-
return slice
123+
target := make([]byte, len(slice))
124+
copy(target, slice)
125+
126+
return target
124127
}
125128

126129
// PixelWidth returns the width of the image in pixels

0 commit comments

Comments
 (0)