[Issue 1832] reading/writing an archive causes data loss; std.zip horribly broken
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 6 00:48:21 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=1832
--- Comment #8 from Andrea Fontana <advmail at katamail.com> 2013-12-06 00:47:18 PST ---
This is another bug. m1 is owned by a1. m1._compressedData refers to data
inside a1. So you're mixing data from two different objects/archives. I don't
think it's a good idea. When you build a2, it tries to read compressed data
from a2 data, but it should read from a1.
There's a simply workaround, but again, there's a problem on library design. If
m1 is just compressed, we can read content it has inside _compressedData, if
any. It filled it before with right reference to a1 data. This solve your bug,
but probalby don't solve the mixing problem and of course it's not an elegant
solution!
(In reply to comment #7)
> I now get a segfault for the following code.
>
> import std.zip;
>
> void main()
> {
> auto a1 = new ZipArchive();
> auto m1 = new ArchiveMember();
> m1.expandedData = new ubyte[](10);
> a1.addMember(m1);
> a1.build();
> auto a2 = new ZipArchive();
> a2.addMember(m1);
> a2.build(); // segfaults
> }
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list