libmspack 0.10.1 → 0.10.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +37 -0
- data/.gitignore +2 -0
- data/ext/Rakefile +1 -1
- data/ext/x86_64-linux/libmspack.so +0 -0
- data/ext/x86_64-windows/mspack.dll +0 -0
- data/lib/libmspack/version.rb +1 -1
- data/lib/libmspack.rb +1 -1
- data/libmspack.gemspec +1 -1
- metadata +6 -348
- data/.travis.yml +0 -5
- data/ext/i386-windows/libmspack.dll +0 -0
- data/ext/libmspack/doc/Doxyfile +0 -9
- data/ext/libmspack/doc/Makefile +0 -8
- data/ext/libmspack/doc/html/annotated.html +0 -104
- data/ext/libmspack/doc/html/bc_s.png +0 -0
- data/ext/libmspack/doc/html/bdwn.png +0 -0
- data/ext/libmspack/doc/html/classes.html +0 -85
- data/ext/libmspack/doc/html/closed.png +0 -0
- data/ext/libmspack/doc/html/dir_f4d90282fe865f947a460986b93b960a.html +0 -83
- data/ext/libmspack/doc/html/doc.png +0 -0
- data/ext/libmspack/doc/html/doxygen.css +0 -1596
- data/ext/libmspack/doc/html/doxygen.png +0 -0
- data/ext/libmspack/doc/html/dynsections.js +0 -97
- data/ext/libmspack/doc/html/files.html +0 -78
- data/ext/libmspack/doc/html/folderclosed.png +0 -0
- data/ext/libmspack/doc/html/folderopen.png +0 -0
- data/ext/libmspack/doc/html/functions.html +0 -454
- data/ext/libmspack/doc/html/functions_vars.html +0 -454
- data/ext/libmspack/doc/html/globals.html +0 -406
- data/ext/libmspack/doc/html/globals_defs.html +0 -316
- data/ext/libmspack/doc/html/globals_func.html +0 -161
- data/ext/libmspack/doc/html/graph_legend.html +0 -102
- data/ext/libmspack/doc/html/graph_legend.md5 +0 -1
- data/ext/libmspack/doc/html/graph_legend.png +0 -0
- data/ext/libmspack/doc/html/index.html +0 -167
- data/ext/libmspack/doc/html/jquery.js +0 -87
- data/ext/libmspack/doc/html/menu.js +0 -26
- data/ext/libmspack/doc/html/menudata.js +0 -56
- data/ext/libmspack/doc/html/mspack_8h.html +0 -2664
- data/ext/libmspack/doc/html/mspack_8h__incl.map +0 -2
- data/ext/libmspack/doc/html/mspack_8h__incl.md5 +0 -1
- data/ext/libmspack/doc/html/mspack_8h__incl.png +0 -0
- data/ext/libmspack/doc/html/mspack_8h_source.html +0 -238
- data/ext/libmspack/doc/html/nav_f.png +0 -0
- data/ext/libmspack/doc/html/nav_g.png +0 -0
- data/ext/libmspack/doc/html/nav_h.png +0 -0
- data/ext/libmspack/doc/html/open.png +0 -0
- data/ext/libmspack/doc/html/search/all_0.html +0 -26
- data/ext/libmspack/doc/html/search/all_0.js +0 -6
- data/ext/libmspack/doc/html/search/all_1.html +0 -26
- data/ext/libmspack/doc/html/search/all_1.js +0 -5
- data/ext/libmspack/doc/html/search/all_10.html +0 -26
- data/ext/libmspack/doc/html/search/all_10.js +0 -8
- data/ext/libmspack/doc/html/search/all_11.html +0 -26
- data/ext/libmspack/doc/html/search/all_11.js +0 -4
- data/ext/libmspack/doc/html/search/all_12.html +0 -26
- data/ext/libmspack/doc/html/search/all_12.js +0 -4
- data/ext/libmspack/doc/html/search/all_13.html +0 -26
- data/ext/libmspack/doc/html/search/all_13.js +0 -4
- data/ext/libmspack/doc/html/search/all_2.html +0 -26
- data/ext/libmspack/doc/html/search/all_2.js +0 -14
- data/ext/libmspack/doc/html/search/all_3.html +0 -26
- data/ext/libmspack/doc/html/search/all_3.js +0 -13
- data/ext/libmspack/doc/html/search/all_4.html +0 -26
- data/ext/libmspack/doc/html/search/all_4.js +0 -6
- data/ext/libmspack/doc/html/search/all_5.html +0 -26
- data/ext/libmspack/doc/html/search/all_5.js +0 -13
- data/ext/libmspack/doc/html/search/all_6.html +0 -26
- data/ext/libmspack/doc/html/search/all_6.js +0 -4
- data/ext/libmspack/doc/html/search/all_7.html +0 -26
- data/ext/libmspack/doc/html/search/all_7.js +0 -5
- data/ext/libmspack/doc/html/search/all_8.html +0 -26
- data/ext/libmspack/doc/html/search/all_8.js +0 -5
- data/ext/libmspack/doc/html/search/all_9.html +0 -26
- data/ext/libmspack/doc/html/search/all_9.js +0 -7
- data/ext/libmspack/doc/html/search/all_a.html +0 -26
- data/ext/libmspack/doc/html/search/all_a.js +0 -144
- data/ext/libmspack/doc/html/search/all_b.html +0 -26
- data/ext/libmspack/doc/html/search/all_b.js +0 -10
- data/ext/libmspack/doc/html/search/all_c.html +0 -26
- data/ext/libmspack/doc/html/search/all_c.js +0 -5
- data/ext/libmspack/doc/html/search/all_d.html +0 -26
- data/ext/libmspack/doc/html/search/all_d.js +0 -7
- data/ext/libmspack/doc/html/search/all_e.html +0 -26
- data/ext/libmspack/doc/html/search/all_e.js +0 -5
- data/ext/libmspack/doc/html/search/all_f.html +0 -26
- data/ext/libmspack/doc/html/search/all_f.js +0 -15
- data/ext/libmspack/doc/html/search/classes_0.html +0 -26
- data/ext/libmspack/doc/html/search/classes_0.js +0 -30
- data/ext/libmspack/doc/html/search/close.png +0 -0
- data/ext/libmspack/doc/html/search/defines_0.html +0 -26
- data/ext/libmspack/doc/html/search/defines_0.js +0 -84
- data/ext/libmspack/doc/html/search/files_0.html +0 -26
- data/ext/libmspack/doc/html/search/files_0.js +0 -4
- data/ext/libmspack/doc/html/search/functions_0.html +0 -26
- data/ext/libmspack/doc/html/search/functions_0.js +0 -33
- data/ext/libmspack/doc/html/search/mag_sel.png +0 -0
- data/ext/libmspack/doc/html/search/nomatches.html +0 -12
- data/ext/libmspack/doc/html/search/search.css +0 -271
- data/ext/libmspack/doc/html/search/search.js +0 -791
- data/ext/libmspack/doc/html/search/search_l.png +0 -0
- data/ext/libmspack/doc/html/search/search_m.png +0 -0
- data/ext/libmspack/doc/html/search/search_r.png +0 -0
- data/ext/libmspack/doc/html/search/searchdata.js +0 -30
- data/ext/libmspack/doc/html/search/variables_0.html +0 -26
- data/ext/libmspack/doc/html/search/variables_0.js +0 -6
- data/ext/libmspack/doc/html/search/variables_1.html +0 -26
- data/ext/libmspack/doc/html/search/variables_1.js +0 -5
- data/ext/libmspack/doc/html/search/variables_10.html +0 -26
- data/ext/libmspack/doc/html/search/variables_10.js +0 -8
- data/ext/libmspack/doc/html/search/variables_11.html +0 -26
- data/ext/libmspack/doc/html/search/variables_11.js +0 -4
- data/ext/libmspack/doc/html/search/variables_12.html +0 -26
- data/ext/libmspack/doc/html/search/variables_12.js +0 -4
- data/ext/libmspack/doc/html/search/variables_13.html +0 -26
- data/ext/libmspack/doc/html/search/variables_13.js +0 -4
- data/ext/libmspack/doc/html/search/variables_2.html +0 -26
- data/ext/libmspack/doc/html/search/variables_2.js +0 -14
- data/ext/libmspack/doc/html/search/variables_3.html +0 -26
- data/ext/libmspack/doc/html/search/variables_3.js +0 -13
- data/ext/libmspack/doc/html/search/variables_4.html +0 -26
- data/ext/libmspack/doc/html/search/variables_4.js +0 -6
- data/ext/libmspack/doc/html/search/variables_5.html +0 -26
- data/ext/libmspack/doc/html/search/variables_5.js +0 -13
- data/ext/libmspack/doc/html/search/variables_6.html +0 -26
- data/ext/libmspack/doc/html/search/variables_6.js +0 -4
- data/ext/libmspack/doc/html/search/variables_7.html +0 -26
- data/ext/libmspack/doc/html/search/variables_7.js +0 -5
- data/ext/libmspack/doc/html/search/variables_8.html +0 -26
- data/ext/libmspack/doc/html/search/variables_8.js +0 -5
- data/ext/libmspack/doc/html/search/variables_9.html +0 -26
- data/ext/libmspack/doc/html/search/variables_9.js +0 -7
- data/ext/libmspack/doc/html/search/variables_a.html +0 -26
- data/ext/libmspack/doc/html/search/variables_a.js +0 -5
- data/ext/libmspack/doc/html/search/variables_b.html +0 -26
- data/ext/libmspack/doc/html/search/variables_b.js +0 -10
- data/ext/libmspack/doc/html/search/variables_c.html +0 -26
- data/ext/libmspack/doc/html/search/variables_c.js +0 -5
- data/ext/libmspack/doc/html/search/variables_d.html +0 -26
- data/ext/libmspack/doc/html/search/variables_d.js +0 -7
- data/ext/libmspack/doc/html/search/variables_e.html +0 -26
- data/ext/libmspack/doc/html/search/variables_e.js +0 -5
- data/ext/libmspack/doc/html/search/variables_f.html +0 -26
- data/ext/libmspack/doc/html/search/variables_f.js +0 -15
- data/ext/libmspack/doc/html/splitbar.png +0 -0
- data/ext/libmspack/doc/html/structmscab__compressor.html +0 -106
- data/ext/libmspack/doc/html/structmscab__decompressor.html +0 -361
- data/ext/libmspack/doc/html/structmscab__decompressor__coll__graph.map +0 -5
- data/ext/libmspack/doc/html/structmscab__decompressor__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmscab__decompressor__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmscabd__cabinet.html +0 -418
- data/ext/libmspack/doc/html/structmscabd__cabinet__coll__graph.map +0 -4
- data/ext/libmspack/doc/html/structmscabd__cabinet__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmscabd__cabinet__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmscabd__file.html +0 -337
- data/ext/libmspack/doc/html/structmscabd__file__coll__graph.map +0 -3
- data/ext/libmspack/doc/html/structmscabd__file__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmscabd__file__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmscabd__folder.html +0 -159
- data/ext/libmspack/doc/html/structmscabd__folder__coll__graph.map +0 -2
- data/ext/libmspack/doc/html/structmscabd__folder__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmscabd__folder__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmschm__compressor.html +0 -226
- data/ext/libmspack/doc/html/structmschm__decompressor.html +0 -299
- data/ext/libmspack/doc/html/structmschm__decompressor__coll__graph.map +0 -7
- data/ext/libmspack/doc/html/structmschm__decompressor__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmschm__decompressor__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmschmc__file.html +0 -169
- data/ext/libmspack/doc/html/structmschmd__file.html +0 -198
- data/ext/libmspack/doc/html/structmschmd__file__coll__graph.map +0 -6
- data/ext/libmspack/doc/html/structmschmd__file__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmschmd__file__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmschmd__header.html +0 -458
- data/ext/libmspack/doc/html/structmschmd__header__coll__graph.map +0 -6
- data/ext/libmspack/doc/html/structmschmd__header__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmschmd__header__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmschmd__sec__mscompressed.html +0 -198
- data/ext/libmspack/doc/html/structmschmd__sec__mscompressed__coll__graph.map +0 -6
- data/ext/libmspack/doc/html/structmschmd__sec__mscompressed__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmschmd__sec__mscompressed__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmschmd__sec__uncompressed.html +0 -140
- data/ext/libmspack/doc/html/structmschmd__sec__uncompressed__coll__graph.map +0 -6
- data/ext/libmspack/doc/html/structmschmd__sec__uncompressed__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmschmd__sec__uncompressed__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmschmd__section.html +0 -142
- data/ext/libmspack/doc/html/structmschmd__section__coll__graph.map +0 -6
- data/ext/libmspack/doc/html/structmschmd__section__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmschmd__section__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmshlp__compressor.html +0 -106
- data/ext/libmspack/doc/html/structmshlp__decompressor.html +0 -106
- data/ext/libmspack/doc/html/structmskwaj__compressor.html +0 -243
- data/ext/libmspack/doc/html/structmskwaj__decompressor.html +0 -245
- data/ext/libmspack/doc/html/structmskwaj__decompressor__coll__graph.map +0 -3
- data/ext/libmspack/doc/html/structmskwaj__decompressor__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmskwaj__decompressor__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmskwajd__header.html +0 -225
- data/ext/libmspack/doc/html/structmslit__compressor.html +0 -106
- data/ext/libmspack/doc/html/structmslit__decompressor.html +0 -106
- data/ext/libmspack/doc/html/structmsoab__compressor.html +0 -151
- data/ext/libmspack/doc/html/structmsoab__decompressor.html +0 -184
- data/ext/libmspack/doc/html/structmspack__file.html +0 -107
- data/ext/libmspack/doc/html/structmspack__system.html +0 -404
- data/ext/libmspack/doc/html/structmspack__system__coll__graph.map +0 -3
- data/ext/libmspack/doc/html/structmspack__system__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmspack__system__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmsszdd__compressor.html +0 -186
- data/ext/libmspack/doc/html/structmsszdd__decompressor.html +0 -246
- data/ext/libmspack/doc/html/structmsszdd__decompressor__coll__graph.map +0 -3
- data/ext/libmspack/doc/html/structmsszdd__decompressor__coll__graph.md5 +0 -1
- data/ext/libmspack/doc/html/structmsszdd__decompressor__coll__graph.png +0 -0
- data/ext/libmspack/doc/html/structmsszddd__header.html +0 -149
- data/ext/libmspack/doc/html/sync_off.png +0 -0
- data/ext/libmspack/doc/html/sync_on.png +0 -0
- data/ext/libmspack/doc/html/szdd_kwaj_format.html +0 -331
- data/ext/libmspack/doc/html/tab_a.png +0 -0
- data/ext/libmspack/doc/html/tab_b.png +0 -0
- data/ext/libmspack/doc/html/tab_h.png +0 -0
- data/ext/libmspack/doc/html/tab_s.png +0 -0
- data/ext/libmspack/doc/html/tabs.css +0 -1
- data/ext/libmspack/doc/szdd_kwaj_format.html +0 -331
- data/ext/libmspack/examples/cabd_memory.c +0 -179
- data/ext/libmspack/examples/cabrip.c +0 -85
- data/ext/libmspack/examples/chmextract.c +0 -121
- data/ext/libmspack/examples/msexpand.c +0 -48
- data/ext/libmspack/examples/multifh.c +0 -435
- data/ext/libmspack/examples/oabextract.c +0 -41
- data/ext/libmspack/test/cabd_md5.c +0 -161
- data/ext/libmspack/test/cabd_test.c +0 -468
- data/ext/libmspack/test/chmd_find.c +0 -95
- data/ext/libmspack/test/chmd_md5.c +0 -67
- data/ext/libmspack/test/chmd_order.c +0 -144
- data/ext/libmspack/test/chmd_test.c +0 -134
- data/ext/libmspack/test/chminfo.c +0 -285
- data/ext/libmspack/test/error.h +0 -22
- data/ext/libmspack/test/kwajd_test.c +0 -119
- data/ext/libmspack/test/md5.c +0 -450
- data/ext/libmspack/test/md5.h +0 -166
- data/ext/libmspack/test/md5_fh.h +0 -123
- data/ext/libmspack/test/test_files/cabd/1.pl +0 -84
- data/ext/libmspack/test/test_files/cabd/2.pl +0 -75
- data/ext/libmspack/test/test_files/cabd/bad_folderindex.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/bad_nofiles.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/bad_nofolders.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/bad_signature.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/cve-2010-2800-mszip-infinite-loop.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/cve-2014-9556-qtm-infinite-loop.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/cve-2014-9732-folders-segfault.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/cve-2015-4470-mszip-over-read.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/cve-2015-4471-lzx-under-read.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/filename-read-violation-1.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/filename-read-violation-2.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/filename-read-violation-3.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/filename-read-violation-4.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/lzx-main-tree-no-lengths.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/lzx-premature-matches.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/mszip_lzx_qtm.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/multi_basic_pt1.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/multi_basic_pt2.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/multi_basic_pt3.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/multi_basic_pt4.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/multi_basic_pt5.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/normal_255c_filename.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/normal_2files_1folder.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/normal_2files_2folders.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_nodata.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_nofiles.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_nofolder.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_shortextheader.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_shortfile1.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_shortfile2.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_shortfolder.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_shortheader.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_nofname.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_noninfo.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_nonname.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_nopinfo.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_nopname.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_shortfname.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_shortninfo.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_shortnname.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_shortpinfo.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/partial_str_shortpname.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/qtm-max-size-block.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_---.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_--D.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_-F-.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_-FD.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_H--.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_H-D.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_HF-.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/reserve_HFD.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/search_basic.cab +0 -0
- data/ext/libmspack/test/test_files/cabd/search_tricky1.cab +0 -0
- data/ext/libmspack/test/test_files/chmd/blank-filenames.chm +0 -0
- data/ext/libmspack/test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm.xor +0 -0
- data/ext/libmspack/test/test_files/chmd/cve-2015-4468-namelen-bounds.chm +0 -0
- data/ext/libmspack/test/test_files/chmd/cve-2015-4469-namelen-bounds.chm +0 -0
- data/ext/libmspack/test/test_files/chmd/cve-2015-4472-namelen-bounds.chm +0 -0
- data/ext/libmspack/test/test_files/chmd/cve-2017-6419-lzx-negative-spaninfo.chm +0 -0
- data/ext/libmspack/test/test_files/chmd/short-system-filenames.chm +0 -0
- data/ext/libmspack/test/test_files/kwajd/f00.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f01.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f02.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f03.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f04.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f10.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f11.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f12.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f13.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f14.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f20.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f21.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f22.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f23.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f24.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f30.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f31.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f32.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f33.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f34.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f40.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f41.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f42.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f43.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f44.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f50.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f51.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f52.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f53.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f54.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f60.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f61.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f62.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f63.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f64.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f70.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f71.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f72.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f73.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f74.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f80.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f81.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f82.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f83.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f84.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f90.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f91.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f92.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f93.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/f94.kwj +0 -0
- data/ext/libmspack/test/test_files/kwajd/make.pl +0 -17
- data/ext/x86_64-linux/liblibmspack.so +0 -0
- data/ext/x86_64-windows/libmspack.dll +0 -0
- data/ext/x86_64-windows-msys/libmspack.dll +0 -0
@@ -1,161 +0,0 @@
|
|
1
|
-
#ifdef HAVE_CONFIG_H
|
2
|
-
#include <config.h>
|
3
|
-
#endif
|
4
|
-
|
5
|
-
#include <stdio.h>
|
6
|
-
#include <stdlib.h>
|
7
|
-
#include <string.h>
|
8
|
-
#include <mspack.h>
|
9
|
-
#include <sys/stat.h>
|
10
|
-
#include <dirent.h>
|
11
|
-
|
12
|
-
#include <md5_fh.h>
|
13
|
-
#include <error.h>
|
14
|
-
|
15
|
-
/**
|
16
|
-
* Matches a cabinet's filename case-insensitively in the filesystem and
|
17
|
-
* returns the case-correct form.
|
18
|
-
*
|
19
|
-
* @param origcab if this is non-NULL, the pathname part of this filename
|
20
|
-
* will be extracted, and the search will be conducted in
|
21
|
-
* that directory.
|
22
|
-
* @param cabname the internal CAB filename to search for.
|
23
|
-
* @return a copy of the full, case-correct filename of the given cabinet
|
24
|
-
* filename, or NULL if the specified filename does not exist on disk.
|
25
|
-
*/
|
26
|
-
static char *find_cabinet_file(char *origcab, char *cabname) {
|
27
|
-
struct dirent *entry;
|
28
|
-
struct stat st_buf;
|
29
|
-
int found = 0, len;
|
30
|
-
char *tail, *cab;
|
31
|
-
DIR *dir;
|
32
|
-
|
33
|
-
/* ensure we have a cabinet name at all */
|
34
|
-
if (!cabname || !cabname[0]) return NULL;
|
35
|
-
|
36
|
-
/* find if there's a directory path in the origcab */
|
37
|
-
tail = origcab ? strrchr(origcab, '/') : NULL;
|
38
|
-
len = (tail - origcab) + 1;
|
39
|
-
|
40
|
-
/* allocate memory for our copy */
|
41
|
-
if (!(cab = (char *) malloc((tail ? len : 2) + strlen(cabname) + 1))) return NULL;
|
42
|
-
|
43
|
-
/* add the directory path from the original cabinet name, or "." */
|
44
|
-
if (tail) memcpy(cab, origcab, (size_t) len);
|
45
|
-
else cab[0]='.', cab[1]='/', len=2;
|
46
|
-
cab[len] = '\0';
|
47
|
-
|
48
|
-
/* try accessing the cabinet with its current name (case-sensitive) */
|
49
|
-
strcpy(&cab[len], cabname);
|
50
|
-
if (stat(cab, &st_buf) == 0) {
|
51
|
-
found = 1;
|
52
|
-
}
|
53
|
-
else {
|
54
|
-
/* cabinet was not found, look for it in the current dir */
|
55
|
-
cab[len] = '\0';
|
56
|
-
if ((dir = opendir(cab))) {
|
57
|
-
while ((entry = readdir(dir))) {
|
58
|
-
if (strcasecmp(cabname, entry->d_name) == 0) {
|
59
|
-
strcat(cab, entry->d_name);
|
60
|
-
found = (stat(cab, &st_buf) == 0);
|
61
|
-
break;
|
62
|
-
}
|
63
|
-
}
|
64
|
-
closedir(dir);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
if (!found || !S_ISREG(st_buf.st_mode)) {
|
69
|
-
/* cabinet not found, or not a regular file */
|
70
|
-
free(cab);
|
71
|
-
cab = NULL;
|
72
|
-
}
|
73
|
-
|
74
|
-
return cab;
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
int main(int argc, char *argv[]) {
|
79
|
-
struct mscab_decompressor *cabd;
|
80
|
-
struct mscabd_cabinet *cab, *c, *c2;
|
81
|
-
struct mscabd_file *file;
|
82
|
-
char *cabname, *newname;
|
83
|
-
int err;
|
84
|
-
|
85
|
-
setbuf(stdout, NULL);
|
86
|
-
setbuf(stderr, NULL);
|
87
|
-
|
88
|
-
/* if self-test reveals an error */
|
89
|
-
MSPACK_SYS_SELFTEST(err);
|
90
|
-
if (err) return 1;
|
91
|
-
|
92
|
-
if (!(cabd = mspack_create_cab_decompressor(&read_files_write_md5))) {
|
93
|
-
fprintf(stderr, "can't make decompressor\n");
|
94
|
-
return 1;
|
95
|
-
}
|
96
|
-
|
97
|
-
for (argv++; (cabname = *argv); argv++) {
|
98
|
-
printf("*** %s\n", cabname);
|
99
|
-
|
100
|
-
if (!(cab = cabd->open(cabd, cabname))) {
|
101
|
-
fprintf(stderr, "cab open error: %s\n", ERROR(cabd));
|
102
|
-
continue;
|
103
|
-
}
|
104
|
-
|
105
|
-
/* prepend any spanning cabinets */
|
106
|
-
for (c = cab; c && (c->flags & MSCAB_HDR_PREVCAB); c = c->prevcab) {
|
107
|
-
if (!(newname = find_cabinet_file(cabname, c->prevname))) {
|
108
|
-
fprintf(stderr, "%s: can't find \"%s\" to prepend\n",
|
109
|
-
cabname, c->prevname);
|
110
|
-
break;
|
111
|
-
}
|
112
|
-
if (!(c2 = cabd->open(cabd, newname))) {
|
113
|
-
fprintf(stderr, "%s: error opening \"%s\" for prepend: %s\n",
|
114
|
-
cabname, newname, ERROR(cabd));
|
115
|
-
break;
|
116
|
-
}
|
117
|
-
if (cabd->prepend(cabd, c, c2) != MSPACK_ERR_OK) {
|
118
|
-
fprintf(stderr, "%s: error prepending \"%s\": %s\n",
|
119
|
-
cabname, newname, ERROR(cabd));
|
120
|
-
break;
|
121
|
-
}
|
122
|
-
}
|
123
|
-
|
124
|
-
/* append any spanning cabinets */
|
125
|
-
for (c = cab; c && (c->flags & MSCAB_HDR_NEXTCAB); c = c->nextcab) {
|
126
|
-
if (!(newname = find_cabinet_file(cabname, c->nextname))) {
|
127
|
-
fprintf(stderr, "%s: can't find \"%s\" to append\n",
|
128
|
-
cabname, c->nextname);
|
129
|
-
break;
|
130
|
-
}
|
131
|
-
if (!(c2 = cabd->open(cabd, newname))) {
|
132
|
-
fprintf(stderr, "%s: error opening \"%s\" for append: %s\n",
|
133
|
-
cabname, newname, ERROR(cabd));
|
134
|
-
break;
|
135
|
-
}
|
136
|
-
if (cabd->append(cabd, c, c2) != MSPACK_ERR_OK) {
|
137
|
-
fprintf(stderr, "%s: error appending \"%s\": %s\n",
|
138
|
-
cabname, newname, ERROR(cabd));
|
139
|
-
break;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
/* extract files */
|
144
|
-
for (file = cab->files; file; file = file->next ) {
|
145
|
-
if (cabd->extract(cabd, file, NULL) == MSPACK_ERR_OK) {
|
146
|
-
printf("%s %s\n", md5_string, file->filename);
|
147
|
-
}
|
148
|
-
else {
|
149
|
-
fprintf(stderr, "%s: error extracting \"%s\": %s\n",
|
150
|
-
cabname, file->filename, ERROR(cabd));
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
/* free all resources */
|
155
|
-
for (c2 = cab->prevcab; c2; c2 = c2->prevcab) free((void*)c2->filename);
|
156
|
-
for (c2 = cab->nextcab; c2; c2 = c2->nextcab) free((void*)c2->filename);
|
157
|
-
cabd->close(cabd, cab);
|
158
|
-
}
|
159
|
-
mspack_destroy_cab_decompressor(cabd);
|
160
|
-
return 0;
|
161
|
-
}
|
@@ -1,468 +0,0 @@
|
|
1
|
-
/* cabinet decompression regression test suite */
|
2
|
-
|
3
|
-
#ifdef HAVE_CONFIG_H
|
4
|
-
# include <config.h>
|
5
|
-
#endif
|
6
|
-
|
7
|
-
#include <stdio.h>
|
8
|
-
#include <stdlib.h>
|
9
|
-
#include <string.h>
|
10
|
-
#include <mspack.h>
|
11
|
-
#include <system.h>
|
12
|
-
|
13
|
-
#define __tf3(x) #x
|
14
|
-
#define __tf2(x) __tf3(x)
|
15
|
-
#define TESTFILE(fname) (__tf2(TEST_FILES) "/" fname)
|
16
|
-
|
17
|
-
unsigned int test_count = 0;
|
18
|
-
|
19
|
-
#define TEST(x) do {\
|
20
|
-
test_count++; \
|
21
|
-
if (!(x)) {printf("%s:%d FAILED %s\n",__func__,__LINE__,#x);exit(1);} \
|
22
|
-
} while (0)
|
23
|
-
|
24
|
-
/* open where cab file doesn't exist */
|
25
|
-
void cabd_open_test_01() {
|
26
|
-
struct mscab_decompressor *cabd;
|
27
|
-
|
28
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
29
|
-
TEST(!cabd->open(cabd, "!!!FILE_WHICH_DOES_NOT_EXIST"));
|
30
|
-
TEST(cabd->last_error(cabd) == MSPACK_ERR_OPEN);
|
31
|
-
|
32
|
-
mspack_destroy_cab_decompressor(cabd);
|
33
|
-
}
|
34
|
-
|
35
|
-
/* normal cab file with 2 files and one folder.
|
36
|
-
* check ALL headers are read correctly */
|
37
|
-
void cabd_open_test_02() {
|
38
|
-
struct mscab_decompressor *cabd;
|
39
|
-
struct mscabd_cabinet *cab;
|
40
|
-
struct mscabd_folder *folder;
|
41
|
-
struct mscabd_file *file;
|
42
|
-
|
43
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
44
|
-
TEST(cab = cabd->open(cabd, TESTFILE("normal_2files_1folder.cab")));
|
45
|
-
|
46
|
-
TEST(cab->next == NULL);
|
47
|
-
TEST(cab->base_offset == 0);
|
48
|
-
TEST(cab->length == 253);
|
49
|
-
TEST(cab->prevcab == NULL); TEST(cab->nextcab == NULL);
|
50
|
-
TEST(cab->prevname == NULL); TEST(cab->nextname == NULL);
|
51
|
-
TEST(cab->previnfo == NULL); TEST(cab->nextinfo == NULL);
|
52
|
-
TEST(cab->set_id = 1570); TEST(cab->set_index == 0);
|
53
|
-
TEST(cab->header_resv == 0);
|
54
|
-
TEST(cab->flags == 0);
|
55
|
-
|
56
|
-
TEST(folder = cab->folders);
|
57
|
-
TEST(folder->next == NULL);
|
58
|
-
TEST(folder->comp_type == 0);
|
59
|
-
TEST(folder->num_blocks == 1);
|
60
|
-
|
61
|
-
file = cab->files;
|
62
|
-
TEST(file && !strcmp(file->filename, "hello.c"));
|
63
|
-
TEST(file->length == 77);
|
64
|
-
TEST(file->attribs == 0x20);
|
65
|
-
TEST(file->time_h == 11);TEST(file->time_m == 13);TEST(file->time_s == 52);
|
66
|
-
TEST(file->date_d == 12);TEST(file->date_m == 3);TEST(file->date_y == 1997);
|
67
|
-
TEST(file->folder == folder); TEST(file->offset == 0);
|
68
|
-
|
69
|
-
file = file->next;
|
70
|
-
TEST(file && !strcmp(file->filename, "welcome.c"));
|
71
|
-
TEST(file->length == 74);
|
72
|
-
TEST(file->attribs == 0x20);
|
73
|
-
TEST(file->time_h == 11);TEST(file->time_m == 15);TEST(file->time_s == 14);
|
74
|
-
TEST(file->date_d == 12);TEST(file->date_m == 3);TEST(file->date_y == 1997);
|
75
|
-
TEST(file->folder == folder); TEST(file->offset == 77);
|
76
|
-
|
77
|
-
TEST(file->next == NULL);
|
78
|
-
|
79
|
-
cabd->close(cabd, cab);
|
80
|
-
mspack_destroy_cab_decompressor(cabd);
|
81
|
-
}
|
82
|
-
|
83
|
-
/* cabs with reserve headers set, ensure they all load correctly */
|
84
|
-
void cabd_open_test_03() {
|
85
|
-
struct mscab_decompressor *cabd;
|
86
|
-
struct mscabd_cabinet *cab;
|
87
|
-
unsigned int i;
|
88
|
-
const char *files[] = {
|
89
|
-
TESTFILE("reserve_---.cab"),
|
90
|
-
TESTFILE("reserve_--D.cab"),
|
91
|
-
TESTFILE("reserve_-F-.cab"),
|
92
|
-
TESTFILE("reserve_-FD.cab"),
|
93
|
-
TESTFILE("reserve_H--.cab"),
|
94
|
-
TESTFILE("reserve_H-D.cab"),
|
95
|
-
TESTFILE("reserve_HF-.cab"),
|
96
|
-
TESTFILE("reserve_HFD.cab"),
|
97
|
-
};
|
98
|
-
|
99
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
100
|
-
|
101
|
-
for (i = 0; i < (sizeof(files)/sizeof(char *)); i++) {
|
102
|
-
TEST(cab = cabd->open(cabd, files[i]));
|
103
|
-
TEST(cab->files && !strcmp(cab->files->filename, "test1.txt"));
|
104
|
-
TEST(cab->files->next && !strcmp(cab->files->next->filename, "test2.txt"));
|
105
|
-
cabd->close(cabd, cab);
|
106
|
-
}
|
107
|
-
|
108
|
-
mspack_destroy_cab_decompressor(cabd);
|
109
|
-
}
|
110
|
-
|
111
|
-
/* some bad cabs, should not load */
|
112
|
-
void cabd_open_test_04() {
|
113
|
-
struct mscab_decompressor *cabd;
|
114
|
-
|
115
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
116
|
-
|
117
|
-
/* cab has enough data for a header, but does not contain real cab data
|
118
|
-
* result should be MSPACK_ERR_SIGNATURE */
|
119
|
-
TEST(!cabd->open(cabd, TESTFILE("bad_signature.cab")));
|
120
|
-
TEST(cabd->last_error(cabd) == MSPACK_ERR_SIGNATURE);
|
121
|
-
|
122
|
-
/* cab has 0 folders */
|
123
|
-
TEST(!cabd->open(cabd, TESTFILE("bad_nofolders.cab")));
|
124
|
-
|
125
|
-
/* cab has 0 files */
|
126
|
-
TEST(!cabd->open(cabd, TESTFILE("bad_nofiles.cab")));
|
127
|
-
|
128
|
-
/* second file in the cab has a folder index for a non-existant folder */
|
129
|
-
TEST(!cabd->open(cabd, TESTFILE("bad_folderindex.cab")));
|
130
|
-
|
131
|
-
/* cab has one file with empty filename */
|
132
|
-
TEST(!cabd->open(cabd, TESTFILE("filename-read-violation-1.cab")));
|
133
|
-
|
134
|
-
mspack_destroy_cab_decompressor(cabd);
|
135
|
-
}
|
136
|
-
|
137
|
-
/* cabs which have been cut short
|
138
|
-
* result should be MSPACK_ERR_READ for missing headers or
|
139
|
-
* MSPACK_ERR_DATAFORMAT for missing/partial strings.
|
140
|
-
* If only data blocks are missing, the cab should open()
|
141
|
-
*/
|
142
|
-
void cabd_open_test_05() {
|
143
|
-
struct mscab_decompressor *cabd;
|
144
|
-
struct mscabd_cabinet *cab;
|
145
|
-
unsigned int i;
|
146
|
-
const char *files[] = {
|
147
|
-
TESTFILE("partial_shortheader.cab"),
|
148
|
-
TESTFILE("partial_shortextheader.cab"),
|
149
|
-
TESTFILE("partial_nofolder.cab"),
|
150
|
-
TESTFILE("partial_shortfolder.cab"),
|
151
|
-
TESTFILE("partial_nofiles.cab"),
|
152
|
-
TESTFILE("partial_shortfile1.cab"),
|
153
|
-
TESTFILE("partial_shortfile2.cab"),
|
154
|
-
};
|
155
|
-
const char *str_files[] = {
|
156
|
-
TESTFILE("partial_str_nopname.cab"),
|
157
|
-
TESTFILE("partial_str_shortpname.cab"),
|
158
|
-
TESTFILE("partial_str_nopinfo.cab"),
|
159
|
-
TESTFILE("partial_str_shortpinfo.cab"),
|
160
|
-
TESTFILE("partial_str_nonname.cab"),
|
161
|
-
TESTFILE("partial_str_shortnname.cab"),
|
162
|
-
TESTFILE("partial_str_noninfo.cab"),
|
163
|
-
TESTFILE("partial_str_shortninfo.cab"),
|
164
|
-
TESTFILE("partial_str_nofname.cab"),
|
165
|
-
TESTFILE("partial_str_shortfname.cab"),
|
166
|
-
};
|
167
|
-
|
168
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
169
|
-
|
170
|
-
for (i = 0; i < (sizeof(files)/sizeof(char *)); i++) {
|
171
|
-
TEST(!cabd->open(cabd, files[i]));
|
172
|
-
TEST(cabd->last_error(cabd) == MSPACK_ERR_READ);
|
173
|
-
}
|
174
|
-
|
175
|
-
for (i = 0; i < (sizeof(str_files)/sizeof(char *)); i++) {
|
176
|
-
TEST(!cabd->open(cabd, str_files[i]));
|
177
|
-
TEST(cabd->last_error(cabd) == MSPACK_ERR_DATAFORMAT ||
|
178
|
-
cabd->last_error(cabd) == MSPACK_ERR_READ);
|
179
|
-
}
|
180
|
-
|
181
|
-
/* lack of data blocks should NOT be a problem for merely reading */
|
182
|
-
TEST(cab = cabd->open(cabd, TESTFILE("partial_nodata.cab")));
|
183
|
-
cabd->close(cabd, cab);
|
184
|
-
mspack_destroy_cab_decompressor(cabd);
|
185
|
-
}
|
186
|
-
|
187
|
-
/* open cab with 255 character filename (maximum allowed) */
|
188
|
-
void cabd_open_test_06() {
|
189
|
-
struct mscab_decompressor *cabd;
|
190
|
-
struct mscabd_cabinet *cab;
|
191
|
-
|
192
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
193
|
-
TEST(cab = cabd->open(cabd, TESTFILE("normal_255c_filename.cab")));
|
194
|
-
|
195
|
-
cabd->close(cabd, cab);
|
196
|
-
mspack_destroy_cab_decompressor(cabd);
|
197
|
-
}
|
198
|
-
|
199
|
-
|
200
|
-
/* open where search file doesn't exist */
|
201
|
-
void cabd_search_test_01() {
|
202
|
-
struct mscab_decompressor *cabd;
|
203
|
-
|
204
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
205
|
-
TEST(!cabd->search(cabd, "!!!FILE_WHICH_DOES_NOT_EXIST"));
|
206
|
-
TEST(cabd->last_error(cabd) == MSPACK_ERR_OPEN);
|
207
|
-
|
208
|
-
mspack_destroy_cab_decompressor(cabd);
|
209
|
-
}
|
210
|
-
|
211
|
-
/* search file using 1-byte buffer */
|
212
|
-
void cabd_search_test_02() {
|
213
|
-
struct mscab_decompressor *cabd;
|
214
|
-
struct mscabd_cabinet *cab;
|
215
|
-
|
216
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
217
|
-
cabd->set_param(cabd, MSCABD_PARAM_SEARCHBUF, 1);
|
218
|
-
TEST(cab = cabd->search(cabd, TESTFILE("search_basic.cab")));
|
219
|
-
|
220
|
-
TEST(cab->base_offset == 6);
|
221
|
-
TEST(cab->files && !strcmp(cab->files->filename, "hello.c"));
|
222
|
-
TEST(cab->files->next && !strcmp(cab->files->next->filename, "welcome.c"));
|
223
|
-
|
224
|
-
TEST(cab->next != NULL);
|
225
|
-
TEST(cab->next->base_offset == 265);
|
226
|
-
TEST(cab->next->files && !strcmp(cab->next->files->filename, "hello.c"));
|
227
|
-
TEST(cab->next->files->next && !strcmp(cab->next->files->next->filename, "welcome.c"));
|
228
|
-
|
229
|
-
TEST(cab->next->next == NULL);
|
230
|
-
|
231
|
-
cabd->close(cabd, cab);
|
232
|
-
mspack_destroy_cab_decompressor(cabd);
|
233
|
-
}
|
234
|
-
|
235
|
-
/* tricky searches */
|
236
|
-
void cabd_search_test_03() {
|
237
|
-
struct mscab_decompressor *cabd;
|
238
|
-
struct mscabd_cabinet *cab;
|
239
|
-
|
240
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
241
|
-
|
242
|
-
/* there is only ONE cab in this file. it is prepended by 4 bytes, "MSCF"
|
243
|
-
* (heh) and reserved fields in the real cab are filled in so the fake one
|
244
|
-
* looks real to the scanner but not the real reader
|
245
|
-
*/
|
246
|
-
TEST(cab = cabd->search(cabd, TESTFILE("search_tricky1.cab")));
|
247
|
-
TEST(cab->next == NULL);
|
248
|
-
TEST(cab->base_offset == 4);
|
249
|
-
TEST(cab->files && !strcmp(cab->files->filename, "hello.c"));
|
250
|
-
TEST(cab->files->next && !strcmp(cab->files->next->filename, "welcome.c"));
|
251
|
-
|
252
|
-
cabd->close(cabd, cab);
|
253
|
-
mspack_destroy_cab_decompressor(cabd);
|
254
|
-
}
|
255
|
-
|
256
|
-
/* basic parameter failures */
|
257
|
-
void cabd_merge_test_01() {
|
258
|
-
struct mscab_decompressor *cabd;
|
259
|
-
struct mscabd_cabinet *cab1, *cab2;
|
260
|
-
|
261
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
262
|
-
TEST(cab1 = cabd->open(cabd, TESTFILE("multi_basic_pt1.cab")));
|
263
|
-
TEST(cab2 = cabd->open(cabd, TESTFILE("multi_basic_pt2.cab")));
|
264
|
-
|
265
|
-
TEST(cabd->append(cabd, cab1, NULL) != MSPACK_ERR_OK);
|
266
|
-
TEST(cabd->append(cabd, NULL, cab1) != MSPACK_ERR_OK);
|
267
|
-
TEST(cabd->append(cabd, cab1, cab1) != MSPACK_ERR_OK);
|
268
|
-
TEST(cabd->prepend(cabd, cab1, NULL) != MSPACK_ERR_OK);
|
269
|
-
TEST(cabd->prepend(cabd, NULL, cab1) != MSPACK_ERR_OK);
|
270
|
-
TEST(cabd->prepend(cabd, cab1, cab1) != MSPACK_ERR_OK);
|
271
|
-
|
272
|
-
/* merge cabs, then try merging again every other way */
|
273
|
-
TEST(cabd->append(cabd, cab1, cab2) == MSPACK_ERR_OK);
|
274
|
-
TEST(cabd->append(cabd, cab2, cab1) != MSPACK_ERR_OK);
|
275
|
-
TEST(cabd->prepend(cabd, cab1, cab2) != MSPACK_ERR_OK);
|
276
|
-
TEST(cabd->prepend(cabd, cab2, cab1) != MSPACK_ERR_OK);
|
277
|
-
TEST(cabd->append(cabd, cab1, cab2) != MSPACK_ERR_OK);
|
278
|
-
|
279
|
-
cabd->close(cabd, cab1);
|
280
|
-
mspack_destroy_cab_decompressor(cabd);
|
281
|
-
}
|
282
|
-
|
283
|
-
/* test merging a normal 5 part single folder cabinet set with slightly
|
284
|
-
* haphazard ordering. should still merge fine */
|
285
|
-
void cabd_merge_test_02() {
|
286
|
-
struct mscab_decompressor *cabd;
|
287
|
-
struct mscabd_cabinet *cab[5];
|
288
|
-
|
289
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
290
|
-
TEST(cab[0] = cabd->open(cabd, TESTFILE("multi_basic_pt1.cab")));
|
291
|
-
TEST(cab[1] = cabd->open(cabd, TESTFILE("multi_basic_pt2.cab")));
|
292
|
-
TEST(cab[2] = cabd->open(cabd, TESTFILE("multi_basic_pt3.cab")));
|
293
|
-
TEST(cab[3] = cabd->open(cabd, TESTFILE("multi_basic_pt4.cab")));
|
294
|
-
TEST(cab[4] = cabd->open(cabd, TESTFILE("multi_basic_pt5.cab")));
|
295
|
-
|
296
|
-
TEST(cabd->append(cabd, cab[0], cab[1]) == MSPACK_ERR_OK);
|
297
|
-
TEST(cabd->prepend(cabd, cab[2], cab[1]) == MSPACK_ERR_OK);
|
298
|
-
TEST(cabd->append(cabd, cab[3], cab[4]) == MSPACK_ERR_OK);
|
299
|
-
TEST(cabd->prepend(cabd, cab[3], cab[2]) == MSPACK_ERR_OK);
|
300
|
-
|
301
|
-
TEST(cab[0]->files != NULL);
|
302
|
-
TEST(cab[0]->files->next != NULL);
|
303
|
-
TEST(cab[0]->files->next->next != NULL);
|
304
|
-
TEST(cab[0]->files->next->next->next == NULL);
|
305
|
-
TEST(cab[0]->files == cab[1]->files);
|
306
|
-
TEST(cab[1]->files == cab[2]->files);
|
307
|
-
TEST(cab[2]->files == cab[3]->files);
|
308
|
-
TEST(cab[3]->files == cab[4]->files);
|
309
|
-
|
310
|
-
TEST(cab[0]->folders != NULL);
|
311
|
-
TEST(cab[0]->folders->next == NULL);
|
312
|
-
TEST(cab[0]->folders == cab[1]->folders);
|
313
|
-
TEST(cab[1]->folders == cab[2]->folders);
|
314
|
-
TEST(cab[2]->folders == cab[3]->folders);
|
315
|
-
TEST(cab[3]->folders == cab[4]->folders);
|
316
|
-
|
317
|
-
cabd->close(cabd, cab[0]);
|
318
|
-
mspack_destroy_cab_decompressor(cabd);
|
319
|
-
}
|
320
|
-
|
321
|
-
/* test bad cabinets cannot be extracted */
|
322
|
-
void cabd_extract_test_01() {
|
323
|
-
struct mscab_decompressor *cabd;
|
324
|
-
struct mscabd_cabinet *cab;
|
325
|
-
struct mscabd_file *file;
|
326
|
-
unsigned int i;
|
327
|
-
const char *files[] = {
|
328
|
-
TESTFILE("cve-2010-2800-mszip-infinite-loop.cab"),
|
329
|
-
TESTFILE("cve-2014-9556-qtm-infinite-loop.cab"),
|
330
|
-
TESTFILE("cve-2015-4470-mszip-over-read.cab"),
|
331
|
-
TESTFILE("cve-2015-4471-lzx-under-read.cab"),
|
332
|
-
TESTFILE("filename-read-violation-2.cab"),
|
333
|
-
TESTFILE("filename-read-violation-3.cab"),
|
334
|
-
TESTFILE("filename-read-violation-4.cab"),
|
335
|
-
TESTFILE("lzx-main-tree-no-lengths.cab"),
|
336
|
-
TESTFILE("lzx-premature-matches.cab"),
|
337
|
-
TESTFILE("qtm-max-size-block.cab"),
|
338
|
-
};
|
339
|
-
|
340
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
341
|
-
|
342
|
-
for (i = 0; i < (sizeof(files)/sizeof(char *)); i++) {
|
343
|
-
TEST(cab = cabd->open(cabd, files[i]));
|
344
|
-
TEST(cab->files != NULL);
|
345
|
-
for (file = cab->files; file; file = file->next) {
|
346
|
-
int err = cabd->extract(cabd, file, "/dev/null");
|
347
|
-
TEST(err == MSPACK_ERR_DATAFORMAT || err == MSPACK_ERR_DECRUNCH);
|
348
|
-
}
|
349
|
-
cabd->close(cabd, cab);
|
350
|
-
}
|
351
|
-
mspack_destroy_cab_decompressor(cabd);
|
352
|
-
}
|
353
|
-
|
354
|
-
/* test that CVE-2014-9732 is fixed */
|
355
|
-
void cabd_extract_test_02() {
|
356
|
-
struct mscab_decompressor *cabd;
|
357
|
-
struct mscabd_cabinet *cab;
|
358
|
-
int err;
|
359
|
-
|
360
|
-
/* the first file in this cabinet belongs to a valid folder. The
|
361
|
-
* second belongs to an invalid folder. Unpacking files 1, 2, 1
|
362
|
-
* caused cabd.c to try and free the invalid folder state left by
|
363
|
-
* extracting from folder 2, which caused a jump to NULL / segfault
|
364
|
-
*/
|
365
|
-
TEST(cabd = mspack_create_cab_decompressor(NULL));
|
366
|
-
TEST(cab = cabd->open(cabd, TESTFILE("cve-2014-9732-folders-segfault.cab")));
|
367
|
-
err = cabd->extract(cabd, cab->files, "/dev/null");
|
368
|
-
TEST(err == MSPACK_ERR_OK);
|
369
|
-
err = cabd->extract(cabd, cab->files->next, "/dev/null");
|
370
|
-
TEST(err == MSPACK_ERR_DATAFORMAT || err == MSPACK_ERR_DECRUNCH);
|
371
|
-
err = cabd->extract(cabd, cab->files, "/dev/null");
|
372
|
-
TEST(err == MSPACK_ERR_OK);
|
373
|
-
cabd->close(cabd, cab);
|
374
|
-
mspack_destroy_cab_decompressor(cabd);
|
375
|
-
}
|
376
|
-
|
377
|
-
#include <md5_fh.h>
|
378
|
-
|
379
|
-
/* test that extraction works with all compression methods */
|
380
|
-
void cabd_extract_test_03() {
|
381
|
-
struct mscab_decompressor *cabd;
|
382
|
-
struct mscabd_cabinet *cab;
|
383
|
-
|
384
|
-
cabd = mspack_create_cab_decompressor(&read_files_write_md5);
|
385
|
-
TEST(cabd != NULL);
|
386
|
-
cab = cabd->open(cabd, TESTFILE("mszip_lzx_qtm.cab"));
|
387
|
-
TEST(cab != NULL);
|
388
|
-
|
389
|
-
/* extract mszip.txt */
|
390
|
-
TEST(cabd->extract(cabd, cab->files, NULL) == MSPACK_ERR_OK);
|
391
|
-
TEST(memcmp(md5_string, "940cba86658fbceb582faecd2b5975d1", 33) == 0);
|
392
|
-
/* extract lzx.txt */
|
393
|
-
TEST(cabd->extract(cabd, cab->files->next, NULL) == MSPACK_ERR_OK);
|
394
|
-
TEST(memcmp(md5_string, "703474293b614e7110b3eb8ac2762b53", 33) == 0);
|
395
|
-
/* extract qtm.txt */
|
396
|
-
TEST(cabd->extract(cabd, cab->files->next->next, NULL) == MSPACK_ERR_OK);
|
397
|
-
TEST(memcmp(md5_string, "98fcfa4962a0f169a3c7fdbcb445cf17", 33) == 0);
|
398
|
-
|
399
|
-
cabd->close(cabd, cab);
|
400
|
-
mspack_destroy_cab_decompressor(cabd);
|
401
|
-
}
|
402
|
-
|
403
|
-
|
404
|
-
/* test that extraction works with multiple compression methods in any order */
|
405
|
-
void cabd_extract_test_04() {
|
406
|
-
struct mscab_decompressor *cabd;
|
407
|
-
struct mscabd_cabinet *cab;
|
408
|
-
struct mscabd_file *f, *files[4];
|
409
|
-
char file_md5s[4][33];
|
410
|
-
int i, err;
|
411
|
-
|
412
|
-
cabd = mspack_create_cab_decompressor(&read_files_write_md5);
|
413
|
-
TEST(cabd != NULL);
|
414
|
-
cab = cabd->open(cabd, TESTFILE("normal_2files_2folders.cab"));
|
415
|
-
TEST(cab != NULL);
|
416
|
-
|
417
|
-
/* extract each file once, in order, keep its md5 checksum */
|
418
|
-
for (f = cab->files, i = 0; i < 4 && f; i++, f=f->next) {
|
419
|
-
files[i] = f;
|
420
|
-
err = cabd->extract(cabd, files[i], NULL);
|
421
|
-
TEST(err == MSPACK_ERR_OK);
|
422
|
-
memcpy(file_md5s[i], md5_string, 33);
|
423
|
-
}
|
424
|
-
TEST(i == 4);
|
425
|
-
|
426
|
-
/* check extracting in any other permutation gives same result */
|
427
|
-
#define T1(i) TEST(cabd->extract(cabd, files[i], NULL) == MSPACK_ERR_OK); \
|
428
|
-
TEST(memcmp(file_md5s[i], md5_string, 33) == 0)
|
429
|
-
#define T(a,b,c,d) T1(a); T1(b); T1(c); T1(d)
|
430
|
-
/*------*/ T(0,1,3,2); T(0,2,1,3); T(0,2,3,1); T(0,3,1,2); T(0,3,2,1);
|
431
|
-
T(1,0,2,3); T(1,0,3,2); T(1,2,0,3); T(1,2,3,0); T(1,3,0,2); T(1,3,2,0);
|
432
|
-
T(2,0,1,3); T(2,0,3,1); T(2,1,0,3); T(2,1,3,0); T(2,3,0,1); T(2,3,1,0);
|
433
|
-
T(3,0,1,2); T(3,0,2,1); T(3,1,0,2); T(3,1,2,0); T(3,2,0,1); T(3,2,1,0);
|
434
|
-
#undef T
|
435
|
-
#undef T1
|
436
|
-
|
437
|
-
cabd->close(cabd, cab);
|
438
|
-
mspack_destroy_cab_decompressor(cabd);
|
439
|
-
}
|
440
|
-
|
441
|
-
int main() {
|
442
|
-
int selftest;
|
443
|
-
|
444
|
-
MSPACK_SYS_SELFTEST(selftest);
|
445
|
-
TEST(selftest == MSPACK_ERR_OK);
|
446
|
-
|
447
|
-
cabd_open_test_01();
|
448
|
-
cabd_open_test_02();
|
449
|
-
cabd_open_test_03();
|
450
|
-
cabd_open_test_04();
|
451
|
-
cabd_open_test_05();
|
452
|
-
cabd_open_test_06();
|
453
|
-
|
454
|
-
cabd_search_test_01();
|
455
|
-
cabd_search_test_02();
|
456
|
-
cabd_search_test_03();
|
457
|
-
|
458
|
-
cabd_merge_test_01();
|
459
|
-
cabd_merge_test_02();
|
460
|
-
|
461
|
-
cabd_extract_test_01();
|
462
|
-
cabd_extract_test_02();
|
463
|
-
cabd_extract_test_03();
|
464
|
-
cabd_extract_test_04();
|
465
|
-
|
466
|
-
printf("ALL %d TESTS PASSED.\n", test_count);
|
467
|
-
return 0;
|
468
|
-
}
|