If I write an "empty" blob initialized to 1 MB to a file like this:
var one_million_bytes = 1000000;
var oneMegabyteBlob = DOpusFactory.Blob(one_million_bytes)
var f = DOpus.FSUtil.OpenFile("C:\dopuswrt.tmp", "wa");
f.Write(oneMegabyteBlob);
f.Close();
...if I open that dopuswrt.tmp file in a text editor (such as Sublime Text) it will display random garbage, I even saw a PNG header in there
I think the blob should initialize to some kind of zero values or something, but it seems its content is some random content of RAM?
You're right, blob.Init
clears it (and blob.Resize
is not needed if creating the blob with size parameter directly).
So without blob.Init
we get random RAM content each time with the size being exactly specified amount of bytes (as it should be).
The issue I think is whether or not the blob.Init
should be implied when creating the blob directly with DOpusFactory.Blob(one_million_bytes)
.
Current behavior allows for accidentally saving the unencrypted RAM content which potentially contains private data such as banking information, passwords, evidence of pirating Opus porn etc.