New file format

Please ask questions here if you are not familiar with fsarchiver
Post Reply
Posts: 53
Joined: Sun Nov 15, 2009 1:08 pm
Location: Moscow, Russia

New file format

Post by Lazy_Kent » Mon Jan 04, 2010 9:38 pm

What is the difference between FsArCh_002 and FsArCh_001?

Site Admin
Posts: 550
Joined: Sat Feb 21, 2004 12:12 pm

Re: New file format

Post by admin » Mon Jan 04, 2010 11:04 pm

The difference is quite small: in the headers, the headerlen value was a u16 (16 bits unsigned integer) and now it's a u32. The problem was there was an integer overflow as soon as the header is bigger than 65535 bytes, and then the considered size was realsize % 65535. The consequence was a crash because we did a malloc(headerlen) and then the buffer was to small. The second consequence would have been a corruption in the archive but fortunately it crashed before that.

Cases with such a big header are quite rare, only one user reported that bug recently. But it had to be fixed and this modification was required in the file format. Each file and data block has an header in the archive. All based on the same structure. We had to run many tests on his machine before I understand what was causing the memory error, and I finally managed to reproduce the bug on my machine. And then it was fixed quickly.

Post Reply