diff --git a/sources/OpenMcdf.Extensions/OLEProperties/PropertyFactory.cs b/sources/OpenMcdf.Extensions/OLEProperties/PropertyFactory.cs index 438cf7ae..af36bad1 100644 --- a/sources/OpenMcdf.Extensions/OLEProperties/PropertyFactory.cs +++ b/sources/OpenMcdf.Extensions/OLEProperties/PropertyFactory.cs @@ -647,8 +647,8 @@ public VT_CF_Property(VTPropertyType vType, bool isVariant) : base(vType, isVari public override object ReadScalarValue(System.IO.BinaryReader br) { - int size = br.ReadInt32(); - byte[] data = br.ReadBytes(size); + uint size = br.ReadUInt32(); + byte[] data = br.ReadBytes((int)size); return data; //br.ReadUInt16();//padding } @@ -656,8 +656,15 @@ public override object ReadScalarValue(System.IO.BinaryReader br) public override void WriteScalarValue(BinaryWriter bw, object pValue) { byte[] r = pValue as byte[]; - if (r != null) + if (r is null) + { + bw.Write(0u); + } + else + { + bw.Write((uint)r.Length); bw.Write(r); + } } } @@ -671,17 +678,23 @@ public VT_BLOB_Property(VTPropertyType vType, bool isVariant) : base(vType, isVa public override object ReadScalarValue(System.IO.BinaryReader br) { - int size = br.ReadInt32(); - byte[] data = br.ReadBytes(size); + uint size = br.ReadUInt32(); + byte[] data = br.ReadBytes((int)size); return data; } public override void WriteScalarValue(BinaryWriter bw, object pValue) { byte[] r = pValue as byte[]; - if (r != null) + if (r is null) + { + bw.Write(0u); + } + else + { + bw.Write((uint)r.Length); bw.Write(r); - + } } }