Merge pull request #17144 from Homebrew/dependabot/bundler/Library/Homebrew/patchelf-1.5.1

This commit is contained in:
Patrick Linnane 2024-04-24 08:35:08 -07:00 committed by GitHub
commit 7b07e4d5a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 10 additions and 9 deletions

View File

@ -40,7 +40,7 @@ GEM
parser (3.3.0.5) parser (3.3.0.5)
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
patchelf (1.5.0) patchelf (1.5.1)
elftools (>= 1.3) elftools (>= 1.3)
plist (3.7.1) plist (3.7.1)
prism (0.24.0) prism (0.24.0)

View File

@ -65,7 +65,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11353/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11353/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parlour-8.1.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parlour-8.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.5.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.5.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.7.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.7.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/prism-0.24.0") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/prism-0.24.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/prism-0.24.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/prism-0.24.0/lib")

View File

@ -451,10 +451,10 @@ module PatchELF
begin begin
new_index = new_section_idx(old_shndx) new_index = new_section_idx(old_shndx)
next unless new_index
rescue ArgumentError rescue ArgumentError
Logger.warn "entry #{entry} in symbol table refers to a non existing section, skipping" Logger.warn "entry #{entry} in symbol table refers to a non existing section, skipping"
end end
next unless new_index
sym[pack[:st_shndx]] = new_index sym[pack[:st_shndx]] = new_index
@ -561,11 +561,12 @@ module PatchELF
if needed_space > start_offset if needed_space > start_offset
needed_space += seg_num_bytes # new load segment is required needed_space += seg_num_bytes # new load segment is required
needed_pages = Helper.alignup(needed_space - start_offset, page_size) / page_size extra_bytes = needed_space - start_offset
needed_pages = Helper.alignup(extra_bytes, page_size) / page_size
Logger.debug "needed pages is #{needed_pages}" Logger.debug "needed pages is #{needed_pages}"
raise PatchError, 'virtual address space underrun' if needed_pages * page_size > first_page raise PatchError, 'virtual address space underrun' if needed_pages * page_size > first_page
shift_file(needed_pages, start_offset) shift_file(needed_pages, start_offset, extra_bytes)
first_page -= needed_pages * page_size first_page -= needed_pages * page_size
start_offset += needed_pages * page_size start_offset += needed_pages * page_size
@ -776,7 +777,7 @@ module PatchELF
end end
# rubocop:enable Metrics/PerceivedComplexity # rubocop:enable Metrics/PerceivedComplexity
def shift_file(extra_pages, start_offset) def shift_file(extra_pages, start_offset, extra_bytes)
raise PatchError, "start_offset(#{start_offset}) < ehdr.num_bytes" if start_offset < ehdr.num_bytes raise PatchError, "start_offset(#{start_offset}) < ehdr.num_bytes" if start_offset < ehdr.num_bytes
oldsz = @buffer.size oldsz = @buffer.size
@ -799,8 +800,8 @@ module PatchELF
p_offset: split_phdr.p_offset - split_shift - shift, p_offset: split_phdr.p_offset - split_shift - shift,
p_vaddr: split_phdr.p_vaddr - split_shift - shift, p_vaddr: split_phdr.p_vaddr - split_shift - shift,
p_paddr: split_phdr.p_paddr - split_shift - shift, p_paddr: split_phdr.p_paddr - split_shift - shift,
p_filesz: split_shift + shift, p_filesz: split_shift + extra_bytes,
p_memsz: split_shift + shift, p_memsz: split_shift + extra_bytes,
p_flags: ELFTools::Constants::PF_R | ELFTools::Constants::PF_W, p_flags: ELFTools::Constants::PF_R | ELFTools::Constants::PF_W,
p_align: page_size p_align: page_size
) )

View File

@ -2,5 +2,5 @@
module PatchELF module PatchELF
# Current gem version. # Current gem version.
VERSION = '1.5.0'.freeze VERSION = '1.5.1'.freeze
end end