Skip to content

Commit

Permalink
UniversalTime: better check for size on parse.
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Dec 15, 2019
1 parent 65cfd8a commit a5e785c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/zip/extra_field/universal_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def mtime=(time)

def merge(binstr)
return if binstr.empty?

size, content = initial_parse(binstr)
size || return
return if !size || size <= 0

@flag, mt, at, ct = content.unpack('Cl<l<l<')
mt && @mtime ||= ::Zip::DOSTime.at(mt)
at && @atime ||= ::Zip::DOSTime.at(at)
Expand Down

0 comments on commit a5e785c

Please sign in to comment.