Skip to content

Commit

Permalink
Generate invalid zim file with invalid offsets in clusters.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Jun 13, 2024
1 parent 261308f commit db7dd24
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Binary file added data/nons/invalid.offset_in_cluster.zim
Binary file not shown.
Binary file added data/withns/invalid.offset_in_cluster.zim
Binary file not shown.
10 changes: 10 additions & 0 deletions scripts/create_test_zimfiles
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ create_broken_zim_file invalid.outofbounds_first_clusterptr.zim \
"$outofzimfile" \
$((cluster_ptr_pos))

cluster_ptrs=($($scriptdir/inspectzim --cluster_table small.zim|tail -n +2))

# Second cluster is not compressed
cluster_address=$((cluster_ptrs[1]))
echo "cluster address is $cluster_address"

create_broken_zim_file invalid.offset_in_cluster.zim \
'\xFF\xFF\xFF\xFF' \
$((cluster_address+5))

dirent_ptrs=($($scriptdir/inspectzim --dirent_ptr_table small.zim|tail -n +2))

dirent1_address=$(encode_uint64 $((dirent_ptrs[0])))
Expand Down

0 comments on commit db7dd24

Please sign in to comment.