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 +4 -4
- data/lib/patchelf/alt_saver.rb +7 -6
- data/lib/patchelf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6864f1200743dc0168be4dfba4f26745189fd922a8c8bee181de7a25be206a1
|
4
|
+
data.tar.gz: c5f80780027865b91dd5f4ab32fd4f24aa04c89e38d73c65190de7cbd529620f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68242284575b512eba346ceb18bf6d399a50ab3bf6da6a5dcea1a69fc7eccbc20d08d502e9f13e54756aa914a38e82539d05256336b3999350567981ca46455
|
7
|
+
data.tar.gz: 67757566f0d8861cd91efb6d5cab270a64f2e09920c94c099bf0bf9cb5ae57b87ff696f4fe8e1418575a6a4f39e0b0036a9aaedcdcd05a473303cd892263e8e3
|
data/lib/patchelf/alt_saver.rb
CHANGED
@@ -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
|
-
|
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 +
|
803
|
-
p_memsz: split_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
|
)
|
data/lib/patchelf/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elftools
|