Closed ironfede closed 2 months ago
As I mentioned previously, I was able to use this branch to create a file which made Windows Explorer on my laptop crash when looking at the custom file properties (although Word seems to open the file without problems) - If I run this test
// Modify some document summary information properties, save to a file, and then validate the expected results
[TestMethod]
public void Test_Empty_User_Property()
{
using (CompoundFile cf = new CompoundFile("2custom.doc"))
{
var dsiStream = cf.RootStorage.GetStream("\u0005DocumentSummaryInformation");
var co = dsiStream.AsOLEPropertiesContainer();
var userProperties = co.UserDefinedProperties;
userProperties.Properties.First(prop => prop.PropertyName == "prop1").Value = "";
co.Save(dsiStream);
cf.SaveAs("zero_length_property.doc");
cf.Close();
}
}
Does anyone else see that when looking at the custom properties sheet on the output file?
e.g.
where 'prop1' should be empty now?
This pr should fix #121 . I've partially followed specifications [MS-OLEPS] I've chosen not to expose any trailing null char BUT embedded nulls will be left untouched.
As stated in note 1 to section 2.5
client application cannot detect trailing nulls after string terminator.
Waiting for some thoughts or comment before merging.
Many thanks, Federico