Skip to content

Commit

Permalink
Merge branch 'lukas/stdlib/fix-unzip64-xlxs/OTP-19241' into maint
Browse files Browse the repository at this point in the history
* lukas/stdlib/fix-unzip64-xlxs/OTP-19241:
  stdlib: Fix unzip to not crash on unused data in zip64 extra header
  • Loading branch information
garazdawi committed Sep 25, 2024
2 parents 71816a2 + 8231321 commit fea5cec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/stdlib/src/zip.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,9 @@ update_zip64(FH, <<LocalHeaderOffset:64/little, Rest/binary>>) when element(#cd_
update_zip64(setelement(#cd_file_header.local_header_offset, FH, LocalHeaderOffset), Rest);
update_zip64(FH, <<DiskNumStart:32/little, Rest/binary>>) when element(#cd_file_header.disk_num_start, FH) == ?MAX_INT32 ->
update_zip64(setelement(#cd_file_header.disk_num_start, FH, DiskNumStart), Rest);
update_zip64(FH, <<>>) ->
update_zip64(FH, _) ->
%% Some zip files (I'm looking at you Excel) places data here even if it is not used...
%% so we have to skip any non-used data instead of mathing on <<>>
FH.

update_extended_timestamp(FileHeader, <<_:5,HasCre:1,HasAcc:1,HasMod:1,Data/binary>> ) ->
Expand Down

0 comments on commit fea5cec

Please sign in to comment.