Method: AppInfo::Helper::IOBlock#loop_length_prefix_io
- Defined in:
- lib/app_info/helper/signatures.rb
#loop_length_prefix_io(io, name:, max_bytes: nil, logger: nil, raw: false, ignore_left_size_precheck: false, &block) ⇒ Object
Only use for uint32 length-prefixed block
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/app_info/helper/signatures.rb', line 29 def loop_length_prefix_io( io, name:, max_bytes: nil, logger: nil, raw: false, ignore_left_size_precheck: false, &block ) index = 0 until io.eof? logger&.debug "#{name} count ##{index}" buffer = length_prefix_block( io, raw: raw, ignore_left_size_precheck: ignore_left_size_precheck ) left_bytes_check(buffer, max_bytes, SecurityError) do |left_bytes| "#{name} too short: #{left_bytes} < #{max_bytes}" end block.call(buffer) index += 1 end end |