Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libarchive wrongly read rar package with a microsoft word in it #765

Open
wtiandong opened this issue Aug 11, 2016 · 4 comments
Open

libarchive wrongly read rar package with a microsoft word in it #765

wtiandong opened this issue Aug 11, 2016 · 4 comments

Comments

@wtiandong
Copy link

Hi all,
I compiled the latest libarchive and had a try. I feed a rar (v2.9) package with a microsoft word document (.docx) in it to the lib, the lib returns me a wrong file list. Here're the details:

code:
`

struct archive *a;
struct archive_entry *entry;
int r;
a = archive_read_new();
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
NSString * filePath = [[NSBundle mainBundle] pathForResource:@"Desktop_aa.rar" ofType:nil];
r = archive_read_open_filename(a, [filePath UTF8String], 10240); // Note 1
if (r != ARCHIVE_OK) {
    NSLog(@"open failed\n");
}
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
    NSLog(@"%s",archive_entry_pathname(entry));
    archive_read_data_skip(a);  // Note 2
}
r = archive_read_free(a);  // Note 3
if (r != ARCHIVE_OK) {
    NSLog(@"free failed!");
}

`

and the Log is:

2016-08-11 20:01:43.872 libarchiveTest[97694:486343] docProps/
2016-08-11 20:01:43.872 libarchiveTest[97694:486343] docProps/app.xml
2016-08-11 20:01:43.873 libarchiveTest[97694:486343] docProps/core.xml
2016-08-11 20:01:43.873 libarchiveTest[97694:486343] docProps/custom.xml
2016-08-11 20:01:43.873 libarchiveTest[97694:486343] word/
2016-08-11 20:01:43.873 libarchiveTest[97694:486343] word/styles.xml
2016-08-11 20:01:43.873 libarchiveTest[97694:486343] word/settings.xml
2016-08-11 20:01:43.874 libarchiveTest[97694:486343] word/theme/
2016-08-11 20:01:43.874 libarchiveTest[97694:486343] word/theme/theme1.xml
2016-08-11 20:01:43.874 libarchiveTest[97694:486343] word/document.xml
2016-08-11 20:01:43.874 libarchiveTest[97694:486343] customXml/
2016-08-11 20:01:43.874 libarchiveTest[97694:486343] customXml/item1.xml
2016-08-11 20:01:43.874 libarchiveTest[97694:486343] customXml/itemProps1.xml
2016-08-11 20:01:43.875 libarchiveTest[97694:486343] word/fontTable.xml
2016-08-11 20:01:43.875 libarchiveTest[97694:486343] word/media/
2016-08-11 20:01:43.875 libarchiveTest[97694:486343] word/media/image18.jpeg
2016-08-11 20:01:43.875 libarchiveTest[97694:486343] word/media/image14.png
2016-08-11 20:01:43.875 libarchiveTest[97694:486343] word/media/image11.jpeg
2016-08-11 20:01:43.875 libarchiveTest[97694:486343] word/media/image9.png
2016-08-11 20:01:43.875 libarchiveTest[97694:486343] word/media/image16.jpeg
2016-08-11 20:01:43.876 libarchiveTest[97694:486343] word/media/image10.png
2016-08-11 20:01:43.876 libarchiveTest[97694:486343] word/media/image8.png
2016-08-11 20:01:43.876 libarchiveTest[97694:486343] word/media/image15.jpeg
2016-08-11 20:01:43.876 libarchiveTest[97694:486343] word/media/image3.png
2016-08-11 20:01:43.876 libarchiveTest[97694:486343] word/media/image6.png
2016-08-11 20:01:43.877 libarchiveTest[97694:486343] word/media/image17.png
2016-08-11 20:01:43.877 libarchiveTest[97694:486343] word/media/image13.png
2016-08-11 20:01:43.877 libarchiveTest[97694:486343] word/media/image12.png
2016-08-11 20:01:43.877 libarchiveTest[97694:486343] word/media/image1.png
2016-08-11 20:01:43.877 libarchiveTest[97694:486343] word/media/image2.jpeg
2016-08-11 20:01:43.877 libarchiveTest[97694:486343] word/media/image4.jpeg
2016-08-11 20:01:43.878 libarchiveTest[97694:486343] word/media/image5.png
2016-08-11 20:01:43.878 libarchiveTest[97694:486343] word/media/image7.png
2016-08-11 20:01:43.878 libarchiveTest[97694:486343] _rels/
2016-08-11 20:01:43.878 libarchiveTest[97694:486343] _rels/.rels
2016-08-11 20:01:43.878 libarchiveTest[97694:486343] customXml/_rels/
2016-08-11 20:01:43.879 libarchiveTest[97694:486343] customXml/_rels/item1.xml.rels
2016-08-11 20:01:43.879 libarchiveTest[97694:486343] word/_rels/
2016-08-11 20:01:43.879 libarchiveTest[97694:486343] word/_rels/document.xml.rels
2016-08-11 20:01:43.879 libarchiveTest[97694:486343] [Content_Types].xml

it seems that it takes word document as a compressed package? But it's OK for zip/tar/tar.gz ...

@kientzle
Copy link
Contributor

Could you provide more details?

How did you create the rar file in question?

When you ask another program (such as unrar) to list the files, what does it show?

Can you provide us with a (small) example file to reproduce this problem?

@wtiandong
Copy link
Author

wtiandong commented Aug 12, 2016

hi kientzle,
http://pan.baidu.com/s/1eSM9qWM
here is the rar package. I uploaded it to a cloud storage website, just click the button on the upper right (with a down arrow icon) and then you can download it and have a inspection. Just two pictures and a docx in it.

@wtiandong
Copy link
Author

I noticed that this docx is generated by an MS Word compliant software called Kingsoft WPS. I can open it with MS Word. But I can also open it with vim. And it shows that it looks like a zip file ... while docx generated by MS Word looks like a binary file with vim....

@jsonn
Copy link
Contributor

jsonn commented Aug 12, 2016

The Office XML format is using a zip wrapper, just like ODT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants