You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changes introduced in #740 made from side potentially unsafe for bytes fields in some cases.
For example whenever GenericDatumReader[GenericRecord].read is called over multiple elements with GenericRecord value for reuse, underlying ByteBuffers are being reused as well, so bytes in the fields are also overwritten.
One workaround is to to not reuse record when reading, but sometimes there's no control over that.
Another – provide custom implicit val afByteBuffer: AvroField[ByteBuffer] or implicit val afBytes: AvroField[Array[Byte]] when declaring AvroField/AvroType.
Previously val afBytes: AvroField[Array[Byte]] used to copy byte array, which was arguably safer behavior.
The text was updated successfully, but these errors were encountered:
Changes introduced in #740 made
from
side potentially unsafe forbytes
fields in some cases.For example whenever
GenericDatumReader[GenericRecord].read
is called over multiple elements withGenericRecord
value for reuse, underlyingByteBuffer
s are being reused as well, so bytes in the fields are also overwritten.Short example (click to expand)
One workaround is to to not reuse record when reading, but sometimes there's no control over that.
Another – provide custom
implicit val afByteBuffer: AvroField[ByteBuffer]
orimplicit val afBytes: AvroField[Array[Byte]]
when declaringAvroField
/AvroType
.Previously
val afBytes: AvroField[Array[Byte]]
used to copy byte array, which was arguably safer behavior.The text was updated successfully, but these errors were encountered: