patchelf 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1e44d5adb39d260d124ebc5231362a134e0719cf2f4a379ddab0d4a7343db66
4
- data.tar.gz: a1cdf1d41641b728e205de2559c86eb4fb7a98f09d6a1882123310edf6701bcf
3
+ metadata.gz: e6864f1200743dc0168be4dfba4f26745189fd922a8c8bee181de7a25be206a1
4
+ data.tar.gz: c5f80780027865b91dd5f4ab32fd4f24aa04c89e38d73c65190de7cbd529620f
5
5
  SHA512:
6
- metadata.gz: 432fd63c969cd337644e4360dbc110a0fae0aaba480174ea3162ddab17814fea9eceeff266cc2f98c571b06830f4ff94ac148b762c49d6fe2135cb692a212a29
7
- data.tar.gz: 9d7b9769ae80913cbc621801f6caee0e1e61ccbc32514302f892e7ecbff3c8439ae89557c1bb3b10d27e21732fe1e7a36bf8be12b8296237a3f6dd39a6b76c3b
6
+ metadata.gz: d68242284575b512eba346ceb18bf6d399a50ab3bf6da6a5dcea1a69fc7eccbc20d08d502e9f13e54756aa914a38e82539d05256336b3999350567981ca46455
7
+ data.tar.gz: 67757566f0d8861cd91efb6d5cab270a64f2e09920c94c099bf0bf9cb5ae57b87ff696f4fe8e1418575a6a4f39e0b0036a9aaedcdcd05a473303cd892263e8e3
@@ -451,10 +451,10 @@ module PatchELF
451
451
 
452
452
  begin
453
453
  new_index = new_section_idx(old_shndx)
454
- next unless new_index
455
454
  rescue ArgumentError
456
455
  Logger.warn "entry #{entry} in symbol table refers to a non existing section, skipping"
457
456
  end
457
+ next unless new_index
458
458
 
459
459
  sym[pack[:st_shndx]] = new_index
460
460
 
@@ -561,11 +561,12 @@ module PatchELF
561
561
  if needed_space > start_offset
562
562
  needed_space += seg_num_bytes # new load segment is required
563
563
 
564
- needed_pages = Helper.alignup(needed_space - start_offset, page_size) / page_size
564
+ extra_bytes = needed_space - start_offset
565
+ needed_pages = Helper.alignup(extra_bytes, page_size) / page_size
565
566
  Logger.debug "needed pages is #{needed_pages}"
566
567
  raise PatchError, 'virtual address space underrun' if needed_pages * page_size > first_page
567
568
 
568
- shift_file(needed_pages, start_offset)
569
+ shift_file(needed_pages, start_offset, extra_bytes)
569
570
 
570
571
  first_page -= needed_pages * page_size
571
572
  start_offset += needed_pages * page_size
@@ -776,7 +777,7 @@ module PatchELF
776
777
  end
777
778
  # rubocop:enable Metrics/PerceivedComplexity
778
779
 
779
- def shift_file(extra_pages, start_offset)
780
+ def shift_file(extra_pages, start_offset, extra_bytes)
780
781
  raise PatchError, "start_offset(#{start_offset}) < ehdr.num_bytes" if start_offset < ehdr.num_bytes
781
782
 
782
783
  oldsz = @buffer.size
@@ -799,8 +800,8 @@ module PatchELF
799
800
  p_offset: split_phdr.p_offset - split_shift - shift,
800
801
  p_vaddr: split_phdr.p_vaddr - split_shift - shift,
801
802
  p_paddr: split_phdr.p_paddr - split_shift - shift,
802
- p_filesz: split_shift + shift,
803
- p_memsz: split_shift + shift,
803
+ p_filesz: split_shift + extra_bytes,
804
+ p_memsz: split_shift + extra_bytes,
804
805
  p_flags: ELFTools::Constants::PF_R | ELFTools::Constants::PF_W,
805
806
  p_align: page_size
806
807
  )
@@ -2,5 +2,5 @@
2
2
 
3
3
  module PatchELF
4
4
  # Current gem version.
5
- VERSION = '1.5.0'.freeze
5
+ VERSION = '1.5.1'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patchelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - david942j
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-17 00:00:00.000000000 Z
11
+ date: 2024-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elftools